Skip to content

Implement native runtimes command --usecdac option - #5943

Merged
noahfalk merged 2 commits into
dotnet:mainfrom
noahfalk:feature/native-runtimes-usecdac
Jul 29, 2026
Merged

Implement native runtimes command --usecdac option#5943
noahfalk merged 2 commits into
dotnet:mainfrom
noahfalk:feature/native-runtimes-usecdac

Conversation

@noahfalk

Copy link
Copy Markdown
Member

Our tests expect to be able to toggle cDAC support on and off. Although most tests run with the managed host enabled, some of them explicitly disable it. Right now if a test disables managed SOS hosting and attempts to run:

!runtimes --usecdac false

the native host doesn't recognize the option and ignores it. The test then runs using default native host policy which will load cDAC. This means tests that claim to be validating the legacy DAC path are actually validating the SOS bundled cDAC instead. This was blocking Rachel's PR dotnet/runtime#131027 because she had both runtime and cDAC changes included but the test was only using the runtime portion of the change without the matching cDAC portion.

Our tests expect to be able to toggle cDAC support on and off. Although most tests run with the managed host enabled,
some of them explicitly disable it. Right now if a test disables managed SOS hosting and attempts to run:

!runtimes --usecdac false

the native host doesn't recognize the option and ignores it. The test then runs using default native host policy which will
load cDAC. This means tests that claim to be validating the legacy DAC path are actually validating the SOS bundled
cDAC instead. This was blocking Rachel's PR dotnet/runtime#131027 because she had both
runtime and cDAC changes included but the test was only using the runtime portion of the change without the matching
cDAC portion.
Copilot AI review requested due to automatic review settings July 29, 2026 06:22
@noahfalk
noahfalk requested a review from a team as a code owner July 29, 2026 06:22
@noahfalk

Copy link
Copy Markdown
Member Author

fyi @hoyosjs @rcj1

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

Adds native SOS support for toggling cDAC usage via !runtimes --usecdac ..., so tests that disable managed SOS hosting can explicitly exercise the legacy DAC path (or force cDAC) instead of silently following the native default policy.

Changes:

  • Adds --usecdac parsing to the native !runtimes command, storing the selection in a global load policy and flushing runtime caches.
  • Plumbs a CDacLoadPolicy through the native runtime implementation and uses it to force/disable cDAC selection.
  • Prevents fallback to dbgeng/legacy paths when cDAC is explicitly forced and cDAC acquisition fails.

Reviewed changes

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

Show a summary per file
File Description
src/SOS/Strike/util.cpp Avoids falling back to dbgeng CLRData when cDAC is explicitly forced and cDAC load fails.
src/SOS/Strike/strike.cpp Implements !runtimes --usecdac parsing, policy display, and cache flush.
src/SOS/Strike/platform/runtimeimpl.h Introduces CDacLoadPolicy and exposes static getters/setters on Runtime.
src/SOS/Strike/platform/runtimeimpl.cpp Implements the policy and integrates it into cDAC selection logic.
src/SOS/Strike/clrma/managedanalysis.cpp Makes CLRMA’s DAC/cDAC acquisition respect the “force cDAC” policy by not falling back when forced.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/SOS/Strike/strike.cpp Outdated
Comment thread src/SOS/Strike/platform/runtimeimpl.cpp
Comment thread src/SOS/Strike/platform/runtimeimpl.cpp
@noahfalk
noahfalk enabled auto-merge (squash) July 29, 2026 21:53
@noahfalk
noahfalk merged commit 61cdd16 into dotnet:main Jul 29, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants