diff --git a/src/Build/Errors/InvalidProjectFileException.cs b/src/Build/Errors/InvalidProjectFileException.cs index 98550caeba2..8d063ba4a38 100644 --- a/src/Build/Errors/InvalidProjectFileException.cs +++ b/src/Build/Errors/InvalidProjectFileException.cs @@ -71,7 +71,7 @@ public InvalidProjectFileException(string message, Exception innerException) /// The assumption is that all the metadata for the outer exception comes from the inner exception, eg., they have the same error code. /// internal InvalidProjectFileException(string message, InvalidProjectFileException innerException) - : this(innerException.ProjectFile, innerException.LineNumber, innerException.ColumnNumber, innerException.EndLineNumber, innerException.EndColumnNumber, message, innerException.ErrorSubcategory, innerException.ErrorCode, innerException.HelpKeyword) + : this(innerException.ProjectFile ?? "MSBUILD", innerException.LineNumber, innerException.ColumnNumber, innerException.EndLineNumber, innerException.EndColumnNumber, message, innerException.ErrorSubcategory, innerException.ErrorCode, innerException.HelpKeyword) { }