Skip to content

Notify profiler about unloads of all class instances when module is unloaded #114107

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

Conversation

alexey-zakharov
Copy link
Contributor

@alexey-zakharov alexey-zakharov commented Apr 1, 2025

Fix ClassLoadStarted and ClassUnloadStarted profiler callbacks symmetry when unloading modules with generic class instances.
The PR solves issue #114068

ClassUnloadStarted and ClassUnloadFinished profiler api callbacks are not called for generic instances which are allocated under a different loader allocator. That:

The suggested change adds a separate EEClass:NotifyUnload method that is called for all classes symmetrically to ClassLoadStarted notification.

Added a profiler test to validate the callbacks correctness for unloading modules and validated it locally.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Apr 1, 2025
Copy link
Contributor

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

alexey-zakharov and others added 2 commits April 2, 2025 10:29
Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
@alexey-zakharov alexey-zakharov force-pushed the dotnet-upstream/fix-classunload-callback-for-generic-instances branch from 6c81f47 to 97ee0de Compare April 2, 2025 08:29
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I have not reviewed the test in detail

Copy link
Member

@mdh1418 mdh1418 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@mdh1418 mdh1418 merged commit 4370474 into dotnet:main Apr 3, 2025
102 of 105 checks passed
@alexey-zakharov alexey-zakharov deleted the dotnet-upstream/fix-classunload-callback-for-generic-instances branch April 3, 2025 18:31
@github-actions github-actions bot locked and limited conversation to collaborators May 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Diagnostics-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants