-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding GetAssemblyLoadContext cDAC API #117939
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for retrieving Assembly Load Context (ALC) information through the cDAC API by implementing the GetAssemblyLoadContext
method. The implementation provides a way to traverse from a method table to its associated Assembly Load Context by following the chain: MethodTable → Module → PEAssembly → HostAssembly/FallbackBinder → AssemblyBinder → ManagedAssemblyLoadContext.
Key changes include:
- Implementation of
GetAssemblyLoadContext
method inSOSDacImpl.cs
with proper error handling and debug validation - Addition of new data structures (
BinderSpaceAssembly
,AssemblyBinder
) to support ALC traversal - Extension of existing data structures (
PEAssembly
) with additional fields for binder information - Addition of
GetBinderAssemblyLoadContext
method to theILoader
contract
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
SOSDacImpl.cs | Implements GetAssemblyLoadContext method with cDAC contract calls and debug validation |
PEAssembly.cs | Adds HostAssembly and FallbackBinder fields to support ALC traversal |
BinderSpaceAssembly.cs | New data structure representing binder space assembly with Binder field |
AssemblyBinder.cs | New data structure representing assembly binder with ManagedAssemblyLoadContext field |
Loader_1.cs | Implements GetBinderALC method to traverse ALC hierarchy |
DataType.cs | Adds enum entries for new data types |
ILoader.cs | Adds GetBinderAssemblyLoadContext method to interface |
peassembly.h | Adds cdac_data template specialization with new field offsets |
assemblybinder.h | Adds cdac_data template specialization and friend declaration |
datadescriptor.h | Adds CDAC type definitions for new data structures |
assembly.hpp | Adds cdac_data template specialization for BINDER_SPACE::Assembly |
Loader.md | Updates documentation with new API and data structure descriptions |
Comments suppressed due to low confidence (2)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Loader_1.cs:298
- The method name 'GetBinderALC' is inconsistent with the interface method name 'GetBinderAssemblyLoadContext'. The implementation should match the interface method name for clarity.
TargetPointer ILoader.GetBinderALC(ModuleHandle handle)
src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.cs:946
- The code calls 'GetBinderAssemblyLoadContext' but the actual implementation method is named 'GetBinderALC', which will cause a runtime error due to the method name mismatch.
// which is apparently not expected by SOS.
Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag |
src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
@max-charlamb Could you please review this as well?
- There is a merge conflict to resolve
- It would be nice to rename ManagedAssemblyLoadContext -> AssemblyLoadContext everywhere as mentioned above (in a separate PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm mod one small nit 👍
/ba-g System.Collections.Tests failure is knonw issue #117939 |
No description provided.