Add DbgShimCreateInstanceFromContractDescriptor cDAC export#131357
Merged
hoyosjs merged 1 commit intoJul 25, 2026
Conversation
Add a new cdac export that provides DAC/SOS interfaces but takes the contract descriptor address directly instead of requiring the data target to implement ICLRContractLocator. This is an internal API for dbgshim. Refactor CLRDataCreateInstanceCore into a descriptor-discovery step plus a shared CreateInstanceFromContractDescriptorCore helper, and fix a latent bug where the QueryInterface HRESULT was ignored and S_OK was returned even on QI failure.
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
noahfalk
approved these changes
Jul 25, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new unmanaged export in the managed cDAC entrypoint layer to create DAC/SOS interfaces directly from a known contract-descriptor address (avoiding an ICLRContractLocator requirement on the data target), while also refactoring the existing CLRDataCreateInstance path to share the instance-creation core and correcting HRESULT handling for QueryInterface.
Changes:
- Add
DbgShimCreateInstanceFromContractDescriptorunmanaged export to create an instance given an explicit contract descriptor address. - Refactor
CLRDataCreateInstanceCoreinto descriptor discovery + sharedCreateInstanceFromContractDescriptorCore. - Fix a correctness bug by returning the actual
QueryInterfaceHRESULT on failure instead of returning success.
hoyosjs
enabled auto-merge (squash)
July 25, 2026 00:01
hoyosjs
added a commit
to hoyosjs/diagnostics
that referenced
this pull request
Jul 25, 2026
When servicing a data-access interface (`IXCLRDataProcess` / `ISOSDacInterface`), dbgshim now resolves the target runtime module's `DotNetRuntimeContractDescriptor` export itself and activates the cDAC through the universal binary's new `DbgShimCreateInstanceFromContractDescriptor` entry point (dotnet/runtime#131357), passing the descriptor address directly. This is needed because dbgshim's data targets don't always implement `ICLRContractLocator`, so the existing `CLRDataCreateInstance` path can't source the descriptor on them. Behavior: - Descriptor not resolvable -> cDAC can't succeed, so it's skipped and we fall through to the legacy DAC. - Descriptor resolvable but the cDAC binary predates the new export -> falls back to `CLRDataCreateInstance` on the same binary (temporary while cDAC gets updated in the tools). - `LegacyDacOnly` policy and the public dbgshim API are unchanged; this is purely additive. - On Windows-host targets the descriptor is read via a small PE export-directory walk (`TryGetPEExportSymbol`) that we already use in runtime; ELF/Mach-O use the existing `TryGetSymbol`. ## Testing `DbgShim.UnitTests` 104/104 pass. The contract path itself can't be exercised until a `mscordaccore_universal` carrying the new export flows in; it degrades gracefully until then.
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.
Add a new cdac export that provides DAC/SOS interfaces but takes the contract descriptor address directly instead of requiring the data target to implement ICLRContractLocator. This is an internal API for dbgshim.
Refactor CLRDataCreateInstanceCore into a descriptor-discovery step plus a shared CreateInstanceFromContractDescriptorCore helper, and fix a latent bug where the QueryInterface HRESULT was ignored and S_OK was returned even on QI failure.
Note
This PR description was drafted with GitHub Copilot.