Skip to content

Commit cc3a4e3

Browse files
committed
Fail GatherReferences gracefully.
1 parent b18f236 commit cc3a4e3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,12 @@ protected void GatherReferences(string projectFilePath, BuildPartition buildPart
127127

128128
if (!buildResult.IsBuildSuccess)
129129
{
130-
throw buildResult.TryToExplainFailureReason(out string reason)
131-
? new Exception(reason)
132-
: new Exception(buildResult.ErrorMessage);
130+
if (!buildResult.TryToExplainFailureReason(out string reason))
131+
{
132+
reason = buildResult.ErrorMessage;
133+
}
134+
logger.WriteLineWarning($"Failed to build source project to obtain dll references. Moving forward without it. Reason: {reason}");
135+
return;
133136
}
134137

135138
var xmlDoc = new XmlDocument();

0 commit comments

Comments
 (0)