SOS: load DBI through dbgshim - #5980
Open
hoyosjs wants to merge 2 commits into
Open
Conversation
hoyosjs
force-pushed
the
juhoyosa/dbi-through-dbgshim
branch
from
August 27, 2026 01:48
5d53e54 to
3e724e8
Compare
max-charlamb
marked this pull request as ready for review
August 27, 2026 15:41
Contributor
There was a problem hiding this comment.
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
ICorDebugProcessactivation (CoreCLR) and factor Desktop CLR activation into a dedicated helper. - SOS.Hosting: introduce a managed
ICLRDebuggingLibraryProvider2implementation and route CorDebug activation through a newIClrDataProcessActivator.CreateCorDebugProcessAPI. - Packaging: include
mscordbi_universalin the shared SOS packaging (gated byPackageWithCDac).
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 on lines
+939
to
+943
| ArrayHolder<WCHAR> dacModulePath = new WCHAR[MAX_LONGPATH + 1]; | ||
| if (MultiByteToWideChar(CP_ACP, 0, dacFilePath, -1, dacModulePath, MAX_LONGPATH) <= 0) | ||
| { | ||
| return HRESULT_FROM_WIN32(GetLastError()); | ||
| } |
Comment on lines
+44
to
+57
| modulePath = IntPtr.Zero; | ||
|
|
||
| string path = fileName?.IndexOf("mscordbi", StringComparison.OrdinalIgnoreCase) >= 0 | ||
| ? _getDbiPath() | ||
| : _getDacPath(); | ||
| if (string.IsNullOrEmpty(path)) | ||
| { | ||
| Trace.TraceError($"RuntimeLibraryProvider: could not resolve {fileName}"); | ||
| return HResult.E_NOINTERFACE; | ||
| } | ||
|
|
||
| modulePath = Marshal.StringToCoTaskMemUni(path); | ||
| Trace.TraceInformation($"RuntimeLibraryProvider: resolved {fileName} to {path}"); | ||
| return HResult.S_OK; |
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.
Depends on #5966.
Route CoreCLR
ICorDebugProcessactivation 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 directmscordbipath because the public dbgshim factory is CoreCLR-SKU-specific.Ship
mscordbi_universalfrom the cDAC transport package beside dbgshim andmscordaccore_universalin the shared SOS packaging used by dotnet-sos, dotnet-dump, and the WinDbg SOS package.Validation:
clrstack -iwith forced cDAC used the bundled DBIclrstack -iused the matching runtime DAC/DBI