Uh oh!
There was an error while loading. Please reload this page.
[cDAC] Implement GetModuleSimpleName for cDAC - #127415
Conversation
Replace the legacy-delegation stub with a contract-based implementation that uses ILoader.GetModuleHandleFromModulePtr and TryGetSimpleName. Follows the GetAppDomainFullName pattern with try/catch and DEBUG legacy validation. Add dump-based integration test. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/d565028d-e96a-4a77-961a-592e8f591a34 Co-authored-by: barosiak <76071368+barosiak@users.noreply.github.com>
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
Implements IDacDbiInterface.GetModuleSimpleName in the managed cDAC DBI (DacDbiImpl) using the ILoader contract, and adds a dump-based integration test to validate the API returns S_OK with a non-empty name for modules in the MultiModule full dump.
Changes:
- Implement
DacDbiImpl.GetModuleSimpleNameusingILoader.GetModuleHandleFromModulePtr+ILoader.TryGetSimpleName. - Add a dump test that iterates all modules and asserts
GetModuleSimpleNamereturnsS_OKwith a non-empty string.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Adds contract-based implementation of GetModuleSimpleName (with DEBUG-time validation against legacy DAC). |
| src/native/managed/cdac/tests/DumpTests/DacDbi/DacDbiLoaderDumpTests.cs | Adds integration coverage to ensure module simple names are returned successfully and are non-empty in dump scenarios. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR implements DacDbiImpl.GetModuleSimpleName using the cDAC ILoader contract (TryGetSimpleName) instead of relying on legacy DAC delegation, and adds a dump-based integration test to ensure module simple names are available and non-empty.
Changes:
- Implement
DacDbiImpl.GetModuleSimpleNameviaILoader.GetModuleHandleFromModulePtr+ILoader.TryGetSimpleName, including DEBUG-only validation against legacy output. - Add a dump test that iterates all modules in the MultiModule full dump and asserts
GetModuleSimpleNamereturnsS_OKand a non-empty string for each.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements GetModuleSimpleName using the loader contract and adds DEBUG-only string comparison against legacy DAC output. |
| src/native/managed/cdac/tests/DumpTests/DacDbi/DacDbiLoaderDumpTests.cs | Adds a dump integration test validating GetModuleSimpleName succeeds and returns a non-empty name for all modules. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Implements DacDbiImpl.GetModuleSimpleName using the cDAC ILoader contract (TryGetSimpleName) instead of delegating to the legacy DAC-only implementation, and adds dump-based coverage to ensure module simple names are returned successfully.
Changes:
- Implement
DacDbiImpl.GetModuleSimpleNameviaTarget.Contracts.Loader.TryGetSimpleNameand copy into the nativeIStringHolder. - Add a dump test that calls
GetModuleSimpleNamefor all modules and assertsS_OKwith a non-empty result. - Fix
NativeStringHolder’s namespace to align with the Legacy assembly and simplify theHResultsreference.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements GetModuleSimpleName using the ILoader contract and retains DEBUG cross-checking against legacy. |
| src/native/managed/cdac/tests/DumpTests/DacDbi/DacDbiLoaderDumpTests.cs | Adds dump-based integration test coverage for GetModuleSimpleName. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/NativeStringHolder.cs | Aligns helper type namespace with the Legacy assembly and updates HRESULT reference. |
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR wires DacDbiImpl.GetModuleSimpleName to the cDAC ILoader contract (instead of delegating only to legacy DAC), and adds dump-test coverage to ensure module simple names are available in dump-based scenarios.
Changes:
- Replace
ILoader.TryGetSimpleNamewithILoader.GetSimpleNameand update the contract implementation/docs accordingly. - Implement
DacDbiImpl.GetModuleSimpleNameusingILoader.GetSimpleNamewith DEBUG-only validation against legacy (when available). - Add/update unit + dump tests for the new simple-name retrieval behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/LoaderTests.cs | Updates loader unit tests to use GetSimpleName instead of TryGetSimpleName. |
| src/native/managed/cdac/tests/DumpTests/DacDbi/DacDbiLoaderDumpTests.cs | Switches debuggee and adds a dump test asserting GetModuleSimpleName returns S_OK and a non-empty name per module. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/NativeStringHolder.cs | Fixes the namespace and aligns HRESULT usage for the native string-holder test helper. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements GetModuleSimpleName via the cDAC loader contract and adds DEBUG validation against legacy output. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataModule.cs | Updates IXCLRDataModule.GetName to use ILoader.GetSimpleName. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Loader_1.cs | Implements ILoader.GetSimpleName in the Loader v1 contract. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/ILoader.cs | Changes the public ILoader interface surface to GetSimpleName. |
| docs/design/datacontracts/Loader.md | Updates contract documentation to reflect GetSimpleName. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
🤖 Copilot Code Review — PR #127415Note This review was generated by Copilot. Holistic AssessmentMotivation: The change makes Approach: The fix follows the exact same pattern already used by Summary: ✅ LGTM. The implementation is consistent with sibling methods, properly tested (including the null case and the existing happy path), and the dump test now validates cDAC/DacDbi agreement. No blocking issues found. Detailed Findings✅ Correctness — Null check follows established patternThe ternary pattern: returnmodule.SimpleName!=TargetPointer.Null?_target.ReadUtf8String(module.SimpleName,strict:true):string.Empty;is identical to ✅ Test Coverage — Both positive and null cases coveredThe PR:
The test refactoring also correctly removes the unnecessary inner scope block from the original test, improving readability. ✅ Dump test comment update — AccurateThe comment update (removing "which loads assemblies from multiple ALCs") is a minor doc improvement that keeps the comment accurate after the debuggee change. 💡 Minor observation — Test structure consistencyThe existing
|
Summary
Implement
GetModuleSimpleNameonDacDbiImplusing theILoadercontract, replacing legacy-only delegation.Changes
DacDbiImpl.cs- ImplementGetModuleSimpleNameviaILoader.GetSimpleNameDacDbiLoaderDumpTests.cs- Add dump test verifying all modules returnS_OKwith a non-empty simple name