-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Description
SampleType field in ThreadSample event from Microsoft-DotNETCore-SampleProfiler is supposed to report if the thread was executing a managed code when the sample was taken. It should have the value EP_SAMPLE_PROFILER_SAMPLE_TYPE_MANAGED in this case and EP_SAMPLE_PROFILER_SAMPLE_TYPE_EXTERNAL otherwise.
It was working as expected until .NET 9, but doesn't work anymore.
Reproduction Steps
Actually, it's enough to take any application that performs active calculation in C#. We expect a majority of samples to have SampleType == EP_SAMPLE_PROFILER_SAMPLE_TYPE_MANAGED in this case.
As an example, https://github.com/JetBrains/DPA-demo can be taken.
Then run an EventPipe session with enabled sampling for the corresponding application, and look at ThreadSample event from Microsoft-DotNETCore-SampleProfiler.
Expected behavior
A majority of samples has SampleType == EP_SAMPLE_PROFILER_SAMPLE_TYPE_MANAGED.
Actual behavior
All (or almost all) samples have SampleType == EP_SAMPLE_PROFILER_SAMPLE_TYPE_EXTERNAL.
Regression?
Yes, it was working as expected in .NET 8 and earlier, but doesn't work in .NET 9 and .NET 10.
Known Workarounds
No workarounds
Configuration
I have checked the following .NET versions:
- 8.0.15 ✅
- 9.0.12 ❌
- 10.0.2 ❌
I reproduced it on macOS 15.7.3 (aarch64), but it definitely reproduces on Linux x64 too.
I don't think that the issue relates to a specific OS, it looks like some common problem in .NET runtime 9+.
Other information
No response