-
Notifications
You must be signed in to change notification settings - Fork 5k
[cDAC] Implement ISOSDacImpl.GetAssemblyList #114800
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 implements the ISOSDacImpl.GetAssemblyList API to support iterating assemblies within an AppDomain. Key changes include:
- Implementation of the GetAssemblyList method in SOSDacImpl.cs with appropriate argument checks, exception handling, and debug validation.
- Addition of new data types (e.g. LoaderAllocator, ArrayListBase, and related cdac_data specializations) and updates to the assembly and appdomain data models to support the new functionality.
- Updates to the ILoader interface and associated loaders in the DataContractReader.Contracts to enumerate assemblies based on various iteration flags.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/native/managed/cdacreader/src/Legacy/SOSDacImpl.cs | Implements the GetAssemblyList API with error checks and debug validation against legacy implementations. |
src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Contracts/Data/LoaderAllocator.cs | Introduces LoaderAllocator data type for tracking loader allocations. |
src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Contracts/Data/Assembly.cs | Extends the Assembly data type with new fields (Module, Error, NotifyFlags, Level) to support assembly status. |
src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Contracts/Data/ArrayListBase.cs | Provides implementation for ArrayListBase and its block elements using modern collection initialization. |
src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Contracts/Data/AppDomain.cs | Adds DomainAssemblyList field for improved assembly enumeration in AppDomains. |
src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Loader_1.cs | Updates ILoader contract with GetAssemblies and IsAssemblyLoaded methods. |
Other coreclr and datadescriptor files | Updates to cdac_data and constant definitions to support the new APIs. |
.../managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Loader_1.cs
Outdated
Show resolved
Hide resolved
Tagging subscribers to this area: @tommcdon |
65a2ec4
to
74cc1a4
Compare
d846425
to
17a623f
Compare
This reverts commit 3e22096.
/azp run runtime-diagnostics |
Azure Pipelines successfully started running 1 pipeline(s). |
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/Assembly.cs
Outdated
Show resolved
Hide resolved
@@ -15,10 +15,32 @@ readonly struct ModuleHandle | |||
[Flags] | |||
enum ModuleFlags | |||
{ | |||
Tenured = 0x00000001, // Set once we know for sure the Module will not be freed until the appdomain itself exits |
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.
There needs to be a detail in the versioned portion of the contract indicating which module flags are actually handled by that specific version of the contract. I want to be able to know which magic constants are meaningful, and the current document does not explain. (This becomes relevant since we may renumber the enum in the runtime, but we won't be able to renumber the enum in the contract interface.)
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.
Created ModuleFlags_1
which represent the runtime implementation of Module::Flags
and a function to map ModuleFlags_1
to ModuleFlags
.
688baab
to
173d72c
Compare
/azp run runtime-diagnostics |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-diagnostics |
Azure Pipelines successfully started running 1 pipeline(s). |
/ba-g Known issue #115070 and unrelated failures |
As part of work for #114336, the cDAC now supports iterating Assemblies in an AppDomain so this API falls out nicely.
It is also used as part of
!dumpdomain
and is relatively easy to test.Given we already have a
ModuleHandle
inILoader
, I wanted to keep using that even if we have to iterate assemblies. On further thought, it appears an assembly can exist without a module. Therefore, I'm wondering if it would be reasonable to convert to using anAssemblyHandle
. Can a module exist without an assembly?Edit: Discussed with @davidwrighton and decided that a
Module
should always exist for all relevantAssembly
instances. Therefore, we can use theModuleHandle
to represent anAssembly
.