A while ago I've added realtime EventPipe support to TraceLog. Recently, I've found out that after upgrading to net8 from net6, method resolution for methods loaded during runtime doesn't work anymore (context: I'm using the realtime EventPipe based TraceLog to run a continuous profiler that captures short spans - and because session startup&shutdown is so expensive, I need to have a session open for the whole duration of the app).
After a lot of to&fro, I've found we don't get MethodLoadVerbose from runtime when the method gets eventually loaded.
Steps to reproduce:
- check out https://github.com/vaind/examples/tree/main/dotnet-eventpipe-method-missing
pwsh run.ps1
This is the result (running on Windows 11). Notice the missing Program FindPrimeNumber on net8+
Running app on net6.0...
MethodDCStopVerbose: Program CreateFromEventPipeSession
MethodDCStopVerbose: Program ProcessInitialRundown
MethodDCStopVerbose: Program+<>c__DisplayClass3_0 .ctor
MethodDCStopVerbose: Program+<>c .cctor
MethodDCStopVerbose: Program+<>c .ctor
MethodDCStopVerbose: Program+<>c__DisplayClass3_0 <ProcessInitialRundown>b__1
MethodDCStopVerbose: Program <Main>
MethodDCStopVerbose: Program Main
MethodDCStopVerbose: Program+<Main>d__1 MoveNext
MethodDCStopVerbose: Program+<>c__DisplayClass1_0 .ctor
MethodDCStopVerbose: Program .cctor
MethodLoadVerbose: Program+<>c__DisplayClass1_0 <Main>g__WaitForFirstEventAsync|0
MethodLoadVerbose: Program+<>c__DisplayClass1_0+<<Main>g__WaitForFirstEventAsync|0>d MoveNext
MethodLoadVerbose: Program+<>c__DisplayClass1_1 .ctor
MethodLoadVerbose: Program+<>c__DisplayClass1_1 <Main>b__4
computation result: 1299709
MethodLoadVerbose: Program+<>c <Main>b__1_3
MethodLoadVerbose: Program FindPrimeNumber
MethodLoadVerbose: Program+<>c <Main>b__1_1
computation result: 1299709
computation result: 1299709
MethodLoadVerbose: Program+<>c <Main>b__1_1
MethodLoadVerbose: Program LogIfRelevant
computation result: 1299709
stopping session...
waiting for the background processing to finish...
program finished
Done running on net6.0
Running app on net8.0...
MethodDCStopVerbose: Program <Main>
MethodDCStopVerbose: Program Main
MethodDCStopVerbose: Program+<Main>d__1 MoveNext
MethodDCStopVerbose: Program+<>c__DisplayClass1_0 .ctor
MethodDCStopVerbose: Program .cctor
MethodDCStopVerbose: Program CreateFromEventPipeSession
MethodDCStopVerbose: Program ProcessInitialRundown
MethodDCStopVerbose: Program+<>c__DisplayClass3_0 .ctor
MethodDCStopVerbose: Program+<>c .cctor
MethodDCStopVerbose: Program+<>c .ctor
MethodDCStopVerbose: Program+<>c__DisplayClass3_0 <ProcessInitialRundown>b__1
computation result: 1299709
computation result: 1299709
computation result: 1299709
computation result: 1299709
stopping session...
waiting for the background processing to finish...
program finished
Done running on net8.0
Running app on net9.0...
MethodDCStopVerbose: Program <Main>
MethodDCStopVerbose: Program Main
MethodDCStopVerbose: Program+<Main>d__1 MoveNext
MethodDCStopVerbose: Program+<>c__DisplayClass1_0 .ctor
MethodDCStopVerbose: Program .cctor
MethodDCStopVerbose: Program CreateFromEventPipeSession
MethodDCStopVerbose: Program ProcessInitialRundown
MethodDCStopVerbose: Program+<>c__DisplayClass3_0 .ctor
MethodDCStopVerbose: Program+<>c .cctor
MethodDCStopVerbose: Program+<>c .ctor
MethodDCStopVerbose: Program+<>c__DisplayClass3_0 <ProcessInitialRundown>b__1
computation result: 1299709
computation result: 1299709
computation result: 1299709
computation result: 1299709
stopping session...
waiting for the background processing to finish...
program finished
Done running on net9.0
This is almost definitely due to some change in .net runtime, however I wasn't able to found out what changed and how to get around it. Any ideas what could be changed in TraceLog to restore the original behavior of getting loaded methods during execution? Or should I just move this issue to http://github.com/dotnet/runtime ?
A while ago I've added realtime EventPipe support to TraceLog. Recently, I've found out that after upgrading to net8 from net6, method resolution for methods loaded during runtime doesn't work anymore (context: I'm using the realtime EventPipe based TraceLog to run a continuous profiler that captures short spans - and because session startup&shutdown is so expensive, I need to have a session open for the whole duration of the app).
After a lot of to&fro, I've found we don't get
MethodLoadVerbosefrom runtime when the method gets eventually loaded.Steps to reproduce:
pwsh run.ps1This is the result (running on Windows 11). Notice the missing
Program FindPrimeNumberon net8+This is almost definitely due to some change in .net runtime, however I wasn't able to found out what changed and how to get around it. Any ideas what could be changed in TraceLog to restore the original behavior of getting loaded methods during execution? Or should I just move this issue to http://github.com/dotnet/runtime ?