Fix NativeAOT dependent handle secondary access with standalone GC#128118
Merged
jkotas merged 1 commit intoMay 13, 2026
Conversation
Contributor
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
jkotas
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix NativeAOT dependent handle secondary get/set helpers to go through
IGCHandleManagerinstead of the CoreCLR handle-table helper functions directly.RhpHandleAllocDependentalready creates dependent handles through the activeIGCHandleManager, which is required for standalone GC support. However,RhHandleGetDependentandRhHandleSetDependentSecondaryaccessed the secondary object through the CoreCLR global helpers:GetDependentHandleSecondary(handle) SetDependentHandleSecondary(handle, secondary)That assumes the handle is a CoreCLR handle-table handle. With standalone GC enabled, the handle belongs to the standalone GC handle manager, so secondary-object access must use the
same handle-manager abstraction as allocation, free, primary store, and extra-info access.
Details
This changes:
RhHandleGetDependentRhHandleSetDependentSecondaryto call:
GCHandleUtilities::GetGCHandleManager()->GetDependentHandleSecondary(handle)GCHandleUtilities::GetGCHandleManager()->SetDependentHandleSecondary(handle, secondary)For the built-in GC handle manager this preserves existing behavior, since the manager implementation forwards to the same CoreCLR helpers internally. For standalone GC
implementations, it lets the active handle manager interpret its own dependent-handle representation.