Skip to content

Commit c52ac06

Browse files
committed
Fix test.
1 parent 604d561 commit c52ac06

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/BenchmarkDotNet/Disassemblers/ClrMdDisassembler.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ private static bool IsValidAddress(ulong address)
7373

7474
internal DisassemblyResult AttachAndDisassemble(ClrMdArgs settings)
7575
{
76-
using var dataTarget = settings.ProcessId == System.Diagnostics.Process.GetCurrentProcess().Id
76+
// Windows CoreCLR fails to disassemble generic types when using CreateSnapshotAndAttach, and succeeds with AttachToProcess. https://github.com/microsoft/clrmd/issues/1334
77+
// Non-Windows (Linux) crashes when using AttachToProcess in the same process.
78+
bool createSnapshot = (!OsDetector.IsWindows() || !RuntimeInformation.IsNetCore) && settings.ProcessId == System.Diagnostics.Process.GetCurrentProcess().Id;
79+
using var dataTarget = createSnapshot
7780
? DataTarget.CreateSnapshotAndAttach(settings.ProcessId)
7881
: DataTarget.AttachToProcess(settings.ProcessId, suspend: false);
7982

0 commit comments

Comments
 (0)