-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICorProfilerCallback::ObjectsAllocatedByClass does not work anymore since dotnet 6 #63806
Comments
Tagging subscribers to this area: @tommcdon Issue DetailsDescriptionThe CLR profiling API callback ICorProfilerCallback::ObjectsAllocatedByClass is not fired by the CLR in dotnet 6. Reproduction Steps
Expected behaviorThe Actual behaviorThe Regression?Yes Known WorkaroundsNo workaround was found Configurationdotnet version:
OS: Windows 11 x64 Other informationCould it be due to these recent changes? @davmason
|
So in order the check my hypothesis about the problem coming from theses changes, I installed the latest dotnet 6 SDK before this commit (6.0.100-preview.2.21155.3), and it works as expected: |
Thanks for reporting this @ogxd, it is indeed caused by that change. Specifically this part: runtime/src/coreclr/vm/proftoeeinterfaceimpl.cpp Lines 1265 to 1287 in 02e22b0
Line 1277 should be I will create a fix sometime soon, we should be able to backport this one to 6.0. If you (or anyone else out there) are interested in contributing to the runtime, this would be a great first issue. The fix is one line, and then it's just adding a simple test to make sure ObjectsAllocByClass works. |
Oh, and it should be possible to work around this by enabling |
Hi @davmason, thanks for the quick reply! A backport fix would be amazing :) I'll try submitting a fix 👍 |
For the workaround, it might just work if you set I would like to see a test if you submit a fix, it hopefully is relatively straightforward but if you get blocked I'm happy to help get you going again. You need to add a managed testcase, like inlining.csproj/inlining.cs in https://github.com/dotnet/runtime/tree/main/src/tests/profiler/unittest, and then a corresponding native profiler like the one in https://github.com/dotnet/runtime/tree/main/src/tests/profiler/native/inlining. The managed app should allocate some classes, and then the native profiler should check that the classes it expected to see were allocated and write "PROFILER TEST PASSES" if everything is right. |
Oh, nevermind about the workaround. I forgot we whitelist the allowable after attach flags. It won't work |
Thanks for the review and the merge @davmason! Shall I make another PR for an eventual backport to 6.0.0 or do you prefer to handle this on your side? |
We have a bot that will do the actual work of opening a PR, but then it has to go through an approval process that I have no control over. I hope it gets through since we have a customer (you) asking for it and it is small, but can't promise anything. |
/backport to release/6.0 |
Don't know why the backport bot isn't working, it looks like I'll have to create it manually |
Closing since it is backported to 6 and in main |
Description
The CLR profiling API callback ICorProfilerCallback::ObjectsAllocatedByClass is not called by the CLR in dotnet 6.
Reproduction Steps
ICorProfilerCallback
interfaceObjectsAllocatedByClass
callbackICorProfilerCallback2
and print in theGarbageCollectionStarted
callback, so that you you'll see thatObjectsAllocatedByClass
is not called whenGarbageCollectionStarted
is.ObjectsAllocatedByClass
is not called.Expected behavior
The
ObjectsAllocatedByClass
callback should be called for each garbage collection like it used to be before.Actual behavior
The
ObjectsAllocatedByClass
callback is never called.Regression?
Yes
Known Workarounds
No workaround was found
Configuration
dotnet version:
OS: Windows 11 x64
Other information
Could it be due to these recent changes? @davmason
The text was updated successfully, but these errors were encountered: