Skip to content

Allow DAC fallback for non-CoreCLR runtimes - #6016

Open
max-charlamb wants to merge 1 commit into
mainfrom
dev/max-charlamb/cdac-fallback-non-coreclr
Open

Allow DAC fallback for non-CoreCLR runtimes#6016
max-charlamb wants to merge 1 commit into
mainfrom
dev/max-charlamb/cdac-fallback-non-coreclr

Conversation

@max-charlamb

Copy link
Copy Markdown
Member

Summary

Add a coreclr cDAC load policy that:

  • requires cDAC activation for CoreCLR runtimes
  • allows DAC fallback for other runtimes, including desktop .NET Framework
  • preserves the existing true, false, and prefer policy behavior

The policy is implemented consistently in the managed and native SOS hosting paths. The SOS cdac test mode now selects runtimes --usecdac coreclr instead of globally requiring cDAC.

Motivation

A process may contain both CoreCLR and desktop .NET Framework runtimes. Requiring standalone cDAC globally prevents SOS from inspecting Framework after switching runtimes because Framework does not support cDAC.

This was exposed by SOSScenarioTests.DualRuntimes in: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1587921

The unrelated interpreter build fix is isolated in #6015.

Validation

  • built the affected managed and native SOS components
  • confirmed SOSScenarioTests.DualRuntimes passes in cdac mode without a test-specific policy change or runtime-path override

Note

This pull request description was generated with GitHub Copilot.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7b2ca30d-742d-402c-8ba5-afec8b6d69a1
Copilot AI lite review requested due to automatic review settings September 9, 2026 17:03
@max-charlamb
max-charlamb requested a review from a team as a code owner September 9, 2026 17:03

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.

🟡 Changes recommended

The native effective-policy mapping currently forces cDAC for RuntimeConfiguration.Unknown, which can incorrectly block DAC fallback for non-CoreCLR runtime types.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new coreclr cDAC load policy across SOS hosting so cDAC is required for CoreCLR runtimes while still allowing legacy DAC fallback for other runtime types (notably desktop .NET Framework), and updates the SOS cdac test mode to use the new policy.

Changes:

  • Introduces CDacLoadPolicy.OnlyUseCDacForCoreClr and wires it through both managed and native SOS hosting paths.
  • Extends the runtimes --usecdac option (managed + native) and settings display to accept/show coreclr.
  • Updates SOS unit test runner cdac mode to use runtimes --usecdac coreclr rather than forcing cDAC globally.
File summaries
File Description
src/tests/SOS.UnitTests/SOSRunner.cs Switches test cdac mode to --usecdac coreclr to avoid blocking inspection of non-CoreCLR runtimes.
src/SOS/Strike/strike.cpp Adds coreclr parsing/output for --usecdac in native SOS.
src/SOS/Strike/platform/runtimeimpl.cpp Implements effective policy mapping for OnlyUseCDacForCoreClr on the native hosting path.
src/SOS/SOS.Hosting/RuntimeWrapper.cs Centralizes the managed “effective policy” mapping and uses it for cDAC policy queries and CorDebug creation.
src/SOS/inc/runtime.h Extends native CDacLoadPolicy enum with OnlyUseCDacForCoreClr.
src/Microsoft.Diagnostics.ExtensionCommands/Host/RuntimesCommand.cs Adds coreclr to the managed runtimes --usecdac option mapping and help text.
src/Microsoft.Diagnostics.ExtensionCommands/Host/CommandFormatHelpers.cs Updates settings display formatting to print coreclr.
src/Microsoft.Diagnostics.DebugServices/CDacLoadPolicy.cs Adds the new public managed enum value and XML doc.
src/Microsoft.Diagnostics.DebugServices.Implementation/Runtime.cs Applies the “effective policy” mapping when creating a ClrRuntime.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

Comment on lines +598 to +605
CDacLoadPolicy policy = GetConfiguredCDacLoadPolicy();
if (policy == CDacLoadPolicy::OnlyUseCDacForCoreClr)
{
return GetRuntimeConfiguration() == IRuntime::WindowsDesktop
? CDacLoadPolicy::PreferCDac
: CDacLoadPolicy::OnlyUseCDac;
}
return policy;
@hoyosjs hoyosjs added the DO NOT MERGE do not merge this PR label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE do not merge this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants