Skip to content

Gate cDAC live debugging on DOTNET_CDAC_LIVE_DEBUGGING env var - #5944

Merged
hoyosjs merged 3 commits into
mainfrom
juhoyosa/cdac-live-debug-envvar-gate
Jul 31, 2026
Merged

hoyosjs merged 3 commits into
mainfrom
juhoyosa/cdac-live-debug-envvar-gate

Conversation

@hoyosjs

@hoyosjs hoyosjs commented Jul 29, 2026

Copy link
Copy Markdown
Member

cDAC support for the live-debugging paths (RegisterForRuntimeStartup* and CreateDebuggingInterfaceFromVersion*) is experimental. Without an opt-in gate it activates by default for any process that has the bundled cDAC present, which is premature.

TryCreateCoreDbgWithCDac now returns E_NOTIMPL unless DOTNET_CDAC_LIVE_DEBUGGING=1 is set. Callers with PreferCDac policy fall back to the legacy DAC transparently; CDacOnly callers fail as expected since they have explicitly demanded cDAC. SetCDacLoadPolicy and the OpenVirtualProcess (dump/attach) path are unaffected.

The CDacLoadPolicy enum comment in dbgshim.h is updated to document the gate.

TryCreateCoreDbgWithCDac returns E_NOTIMPL unless the env var is set
to '1', keeping cDAC disabled by default on the live-debug paths
(RegisterForRuntimeStartup* and CreateDebuggingInterfaceFromVersion*).
SetCDacLoadPolicy and the OpenVirtualProcess path are unaffected.

Co-authored-by: Copilot App <[email protected]>
Copilot AI review requested due to automatic review settings July 29, 2026 22:35
@hoyosjs
hoyosjs requested a review from a team as a code owner July 29, 2026 22:35
@hoyosjs
hoyosjs requested a review from noahfalk July 29, 2026 22:37

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 adds an opt-in gate for using cDAC in live debugging activation paths in dbgshim, requiring DOTNET_CDAC_LIVE_DEBUGGING=1 before attempting cDAC so that experimental behavior doesn’t activate by default when a bundled cDAC is present.

Changes:

  • Gate TryCreateCoreDbgWithCDac behind DOTNET_CDAC_LIVE_DEBUGGING=1, returning E_NOTIMPL when not enabled so PreferCDac callers can transparently fall back.
  • Update CDacLoadPolicy documentation in dbgshim.h to describe the new gating behavior for live-debugging entrypoints.

Reviewed changes

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

File Description
src/dbgshim/dbgshim.h Documents the live-debugging cDAC opt-in gate for CDacLoadPolicy.
src/dbgshim/dbgshim.cpp Implements the DOTNET_CDAC_LIVE_DEBUGGING environment variable gate in TryCreateCoreDbgWithCDac.

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

Comment thread src/dbgshim/dbgshim.h Resolved
Comment thread src/dbgshim/dbgshim.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.

I think we might need to tweak the error handling, but otherwise looks good.

Comment thread src/dbgshim/dbgshim.cpp Resolved
hoyosjs and others added 2 commits July 29, 2026 16:23
- Fix Clang build error: SString::Equals takes const SString& but W() produces
  a raw char16_t literal. Use SL(W("1")) (SString::Literal ctor) instead.
- Apply cdacEvaluated = false guard when TryCreateCoreDbgWithCDac returns
  E_NOTIMPL at the two remaining call sites (was only at the first). This
  ensures SelectActivationResult returns the legacy DAC error instead of
  E_NOTIMPL when the env var gate is not set.

Co-authored-by: Copilot App <[email protected]>
- Keep live-debug cDAC env-var gate in TryCreateCoreDbgWithCDac.
- Remove per-call-site cdacEvaluated toggles for E_NOTIMPL in live paths.
- Update SelectActivationResult to treat E_NOTIMPL as non-actionable and
  prefer fallback errors when available.
- Preserve caller fallback seed values and policy gating behavior.

Co-authored-by: Copilot App <[email protected]>
@hoyosjs

hoyosjs commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

/ba-g error is already correlated.

@hoyosjs
hoyosjs merged commit 02d6e10 into main Jul 31, 2026
23 of 25 checks passed
@hoyosjs
hoyosjs deleted the juhoyosa/cdac-live-debug-envvar-gate branch July 31, 2026 18:16
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 31, 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.

3 participants