Skip to content

[cDAC] Always assign IStringHolder in DacDbi GetModulePath for pathless modules - #131518

Open
tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/cdac-getmodulepath-dynamic-module
Open

[cDAC] Always assign IStringHolder in DacDbi GetModulePath for pathless modules#131518
tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/cdac-getmodulepath-dynamic-module

Conversation

@tommcdon

Copy link
Copy Markdown
Member

cDAC's DacDbiImpl.GetModulePath returned S_OK with pResult=FALSE but left the IStringHolder unassigned when a module has no on-disk path (dynamic / in-memory modules, e.g. LCG DynamicMethod / DLR). The native DBI (CordbModule::GetModulePath) asserts m_strModulePath.IsSet(), so an unassigned holder makes ICorDebugModule::GetName fail with E_FAIL, which the debugger surfaces as "bad OnModuleLoad" on the module-load callback.

…ss modules

cDAC's DacDbiImpl.GetModulePath returned S_OK with pResult=FALSE but left
the IStringHolder unassigned when a module has no on-disk path (dynamic /
in-memory modules, e.g. LCG DynamicMethod / DLR). The native DBI
(CordbModule::GetModulePath) asserts m_strModulePath.IsSet(), so an
unassigned holder makes ICorDebugModule::GetName fail with E_FAIL, which
the debugger surfaces as "bad OnModuleLoad" on the module-load callback.

The legacy DAC (DacDbiInterfaceImpl::GetModulePath) always assigns the
holder - to an empty string in the pathless case. Match that behavior so
cDAC and legacy agree and dynamic-module scenarios work under
DOTNET_ENABLE_CDAC.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ea95a5dd-3256-4da0-8278-80b40e717cd5
@tommcdon tommcdon added this to the 11.0.0 milestone Jul 29, 2026
@tommcdon
tommcdon requested a review from rcj1 July 29, 2026 02:55
@tommcdon tommcdon self-assigned this Jul 29, 2026
Copilot AI review requested due to automatic review settings July 29, 2026 02:55
@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes cDAC’s DacDbiImpl.GetModulePath so that, when a module has no on-disk path, the method still assigns the provided IStringHolder (to an empty string) instead of leaving it uninitialized.

Changes:

  • Ensure pStrFilename is always assigned (to string.Empty) when GetModulePath returns pResult == FALSE due to an empty module path.

Comment on lines +325 to +326
// pStrFilename needs to be set for ICorDebugModule::GetName to succeed.
hr = StringHolderAssignCopy(pStrFilename, string.Empty);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants