Skip to content

SOS: load DBI through dbgshim - #5980

Merged
hoyosjs merged 16 commits into
dotnet:mainfrom
hoyosjs:juhoyosa/dbi-through-dbgshim
Sep 3, 2026
Merged

hoyosjs merged 16 commits into
dotnet:mainfrom
hoyosjs:juhoyosa/dbi-through-dbgshim

Conversation

@hoyosjs

@hoyosjs hoyosjs commented Aug 25, 2026

Copy link
Copy Markdown
Member

Depends on #5966.

Route CoreCLR ICorDebugProcess activation through dbgshim so the bundled universal DBI and cDAC are tried first, with SOS's existing DAC/DBI resolver retained as the provider fallback. Keep desktop CLR on its existing direct mscordbi path because the public dbgshim factory is CoreCLR-SKU-specific.

Ship mscordbi_universal from the cDAC transport package beside dbgshim and mscordaccore_universal in the shared SOS packaging used by dotnet-sos, dotnet-dump, and the WinDbg SOS package.

Validation:

  • managed SOS.Hosting build
  • native x64 build
  • DbgShim.UnitTests: 36/36
  • published dotnet-dump clrstack -i with forced cDAC used the bundled DBI
  • provider fallback clrstack -i used the matching runtime DAC/DBI
  • win-x64 dotnet-sos, dotnet-dump, and Microsoft.NETCore.SOS packages contain dbgshim, universal cDAC, and universal DBI

@hoyosjs
hoyosjs force-pushed the juhoyosa/dbi-through-dbgshim branch from 5d53e54 to 3e724e8 Compare August 27, 2026 01:48
@max-charlamb
max-charlamb marked this pull request as ready for review August 27, 2026 15:41
Copilot AI lite review requested due to automatic review settings August 27, 2026 15:41
@max-charlamb
max-charlamb requested a review from a team as a code owner August 27, 2026 15:41

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 updates SOS’s DBI activation path so CoreCLR ICorDebugProcess creation is routed through dbgshim (preferring the bundled universal DBI + cDAC first), while keeping the existing direct mscordbi activation path for Desktop CLR. It also updates managed hosting to use the same dbgshim-based activation and packages the universal DBI alongside existing SOS assets.

Changes:

  • Native SOS: add dbgshim-based ICorDebugProcess activation (CoreCLR) and factor Desktop CLR activation into a dedicated helper.
  • SOS.Hosting: introduce a managed ICLRDebuggingLibraryProvider2 implementation and route CorDebug activation through a new IClrDataProcessActivator.CreateCorDebugProcess API.
  • Packaging: include mscordbi_universal in the shared SOS packaging (gated by PackageWithCDac).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/SOS/Strike/platform/runtimeimpl.h Adds CreateDesktopCorDebugProcess declaration to separate Desktop CLR activation path.
src/SOS/Strike/platform/runtimeimpl.cpp Implements Desktop CLR DBI activation helper and routes CoreCLR DBI activation through dbgshim + library provider.
src/SOS/SOS.Hosting/RuntimeWrapper.cs Updates managed DBI activation to use IClrDataProcessActivator for CoreCLR and improves HRESULT propagation.
src/SOS/SOS.Hosting/RuntimeLibraryProvider.cs Adds managed ICLRDebuggingLibraryProvider2 implementation to resolve DBI/DAC paths for dbgshim.
src/SOS/SOS.Hosting/ClrDataProcessActivator.cs Refactors dbgshim initialization and adds CreateCorDebugProcess to activate ICorDebugProcess via dbgshim.
src/sos-packaging.props Packages mscordbi_universal for supported RIDs when PackageWithCDac is enabled.
src/Microsoft.Diagnostics.DebugServices/IClrDataProcessActivator.cs Extends the activator interface with a new CorDebug activation API.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/SOS/Strike/platform/runtimeimpl.cpp Resolved

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo the policy handling

Comment thread src/SOS/SOS.Hosting/RuntimeWrapper.cs Resolved
Comment thread src/SOS/Strike/platform/runtimeimpl.cpp Resolved
Teach dbgshim to recognize Desktop CLR through the standard ICLRDebugging path and apply the configured cDAC policy consistently to data access and DBI activation.

Verify provider-resolved DAC and DBI binaries with WinTrust, Microsoft root policy, and the .NET DAC OID before loading them. Keep bundled universal DBI on the tool-asset trust path, preserve DAC-before-DBI ordering, and contain provider callback failures.
Comment thread eng/build.ps1 Resolved
Comment thread eng/build.sh Resolved
Comment thread eng/build.sh Resolved
Comment thread src/dbgshim/debugshim.cpp Resolved
Comment thread eng/build.sh Resolved

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still a couple of nit suggestions waiting to be resolved, but LGTM!

Co-authored-by: Noah Falk <[email protected]>
Co-authored-by: Juan Hoyos <[email protected]>
@hoyosjs
hoyosjs enabled auto-merge (squash) September 3, 2026 05:31
@hoyosjs
hoyosjs disabled auto-merge September 3, 2026 08:10
@hoyosjs

hoyosjs commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

/ba-g prior commit was green except for know failures in the new SOS harness.

@hoyosjs
hoyosjs merged commit ec5af2a into dotnet:main Sep 3, 2026
11 of 16 checks passed
@hoyosjs
hoyosjs deleted the juhoyosa/dbi-through-dbgshim branch September 4, 2026 11:54
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants