microsoft / clrmd

Microsoft.Diagnostics.Runtime is a set of APIs for introspecting processes and dumps.
MIT License
1.05k stars 254 forks source link

GetMethodByHandle is not able to retrieve constructed generic methods #1238

Closed hez2010 closed 6 months ago

hez2010 commented 6 months ago

I'm using clrmd to get the method info returned from MethodJittingStartedTraceData:

using var dataTarget = DataTarget.AttachToProcess(process.Id, false);
var version = dataTarget.ClrVersions.First();
using var runtime = version.CreateRuntime();

MethodJittingStartedTraceData data = ...; // returned from EventPipeEventSource
var method = runtime.GetMethodByHandle((ulong)data.MethodID);
Console.WriteLine(method);

If the method is a generic method, clrmd cannot find the method and results in null being printed in the above code.

hez2010 commented 6 months ago

Fixed by #1240.