diff --git a/src/BenchmarkDotNet/Toolchains/Executor.cs b/src/BenchmarkDotNet/Toolchains/Executor.cs index 4303f118ee..44b321929f 100644 --- a/src/BenchmarkDotNet/Toolchains/Executor.cs +++ b/src/BenchmarkDotNet/Toolchains/Executor.cs @@ -81,7 +81,12 @@ private ExecuteResult Execute(Process process, BenchmarkCase benchmarkCase, Sync if (loggerWithDiagnoser.LinesWithResults.Any(line => line.Contains("BadImageFormatException"))) logger.WriteLineError("You are probably missing AnyCPU in your .csproj file."); - return new ExecuteResult(true, process.ExitCode, process.Id, loggerWithDiagnoser.LinesWithResults, loggerWithDiagnoser.LinesWithExtraOutput, launchIndex); + return new ExecuteResult(true, + process.HasExited ? process.ExitCode : null, + process.Id, + loggerWithDiagnoser.LinesWithResults, + loggerWithDiagnoser.LinesWithExtraOutput, + launchIndex); } private ProcessStartInfo CreateStartInfo(BenchmarkCase benchmarkCase, ArtifactsPaths artifactsPaths, string args, IResolver resolver)