Skip to content

Commit

Permalink
Provide more information with BadImageReferenceException (#6240)
Browse files Browse the repository at this point in the history
  • Loading branch information
Forgind committed Mar 15, 2021
1 parent 0e4b0c2 commit 7a5b5e0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ private void LogReferenceErrors(Reference reference, MessageImportance importanc
}
else if (itemError is BadImageReferenceException)
{
message = Log.FormatResourceString("ResolveAssemblyReference.FailedWithException", itemError.Message);
message = Log.FormatResourceString("ResolveAssemblyReference.FailedWithException", itemError.InnerException?.ToString() ?? itemError.ToString());
helpKeyword = "MSBuild.ResolveAssemblyReference.FailedWithException";
dependencyProblem = false;
}
Expand All @@ -1578,8 +1578,7 @@ private void LogReferenceErrors(Reference reference, MessageImportance importanc
Debug.Assert(false, "Unexpected exception type.");
}

string messageOnly;
string warningCode = Log.ExtractMessageCode(message, out messageOnly);
string warningCode = Log.ExtractMessageCode(message, out string messageOnly);

// Treat as warning if this is primary and the problem wasn't with a dependency, otherwise, make it a comment.
if (reference.IsPrimary && !dependencyProblem)
Expand Down

0 comments on commit 7a5b5e0

Please sign in to comment.