Skip to content

Commit 130f0fb

Browse files
Additional diagnostics in WindowsDisassembler (see #1836)
1 parent 4087868 commit 130f0fb

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/BenchmarkDotNet/Disassemblers/WindowsDisassembler.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ public DisassemblyResult Disassemble(DiagnoserActionParameters parameters)
3131
{
3232
string resultsPath = Path.GetTempFileName();
3333

34-
string errors = ProcessHelper.RunAndReadOutput(
35-
GetDisassemblerPath(parameters.Process, parameters.BenchmarkCase.Job.Environment.Platform),
36-
BuildArguments(parameters, resultsPath));
34+
string disassemblerPath = GetDisassemblerPath(parameters.Process, parameters.BenchmarkCase.Job.Environment.Platform);
35+
string arguments = BuildArguments(parameters, resultsPath);
36+
string errors = ProcessHelper.RunAndReadOutput(disassemblerPath, arguments);
3737

3838
if (!string.IsNullOrEmpty(errors))
39+
{
3940
parameters.Config.GetCompositeLogger().WriteError(errors);
41+
return new DisassemblyResult { Errors = new[] { errors } };
42+
}
4043

4144
try
4245
{
@@ -48,6 +51,10 @@ public DisassemblyResult Disassemble(DiagnoserActionParameters parameters)
4851
return (DisassemblyResult)serializer.Deserialize(reader);
4952
}
5053
}
54+
catch (Exception e)
55+
{
56+
throw new Exception($"Can't read disassembly diagnostic file (DisassemblerPath = '{disassemblerPath}', Arguments = '{arguments}')", e);
57+
}
5158
finally
5259
{
5360
File.Delete(resultsPath);
@@ -80,9 +87,9 @@ private static string GetDisassemblerPath(string architectureName)
8087

8188
var dir = new FileInfo(assemblyWithDisassemblersInResources.Location).Directory ?? throw new DirectoryNotFoundException();
8289
string disassemblerPath = Path.Combine(
83-
dir.FullName,
84-
FolderNameHelper.ToFolderName(BenchmarkDotNetInfo.FullVersion), // possible update
85-
exeName); // separate process per architecture!!
90+
dir.FullName,
91+
FolderNameHelper.ToFolderName(BenchmarkDotNetInfo.FullVersion), // possible update
92+
exeName); // separate process per architecture!!
8693

8794
Path.GetDirectoryName(disassemblerPath).CreateIfNotExists();
8895

0 commit comments

Comments
 (0)