Skip to content

Add cDAC no-fallback test leg to runtime-diagnostics pipeline#126752

Open
max-charlamb wants to merge 3 commits intomainfrom
dev/max-charlamb/cdac-no-fallback
Open

Add cDAC no-fallback test leg to runtime-diagnostics pipeline#126752
max-charlamb wants to merge 3 commits intomainfrom
dev/max-charlamb/cdac-no-fallback

Conversation

@max-charlamb
Copy link
Copy Markdown
Member

Summary

Add a cDAC no-fallback test leg to the runtime-diagnostics pipeline that runs diagnostics tests with the cDAC operating without any legacy DAC delegation.

Changes

Entrypoints.cs

When the CDAC_NO_FALLBACK environment variable is set to 1, CreateSosInterface passes null for the legacy DAC implementation to SOSDacImpl. This means any cDAC API that has not been implemented yet will return E_NOTIMPL instead of silently delegating to the legacy DAC.

runtime-diagnostics.yml

Added a third test job (cDAC_no_fallback) that runs with useCdac enabled and CDAC_NO_FALLBACK=1.

This runs alongside the existing cDAC (with fallback) and DAC (legacy-only) legs, giving visibility into which SOS tests pass on the cDAC alone.

Motivation

The existing cDAC test leg always has the legacy DAC as a fallback, so unimplemented APIs are silently handled. This new leg makes gaps visible, helping track progress toward full cDAC coverage.

When the CDAC_NO_FALLBACK environment variable is set to '1',
Entrypoints.CreateSosInterface passes null for the legacy DAC impl,
forcing SOSDacImpl to run without any legacy delegation. This exposes
any APIs that haven't been implemented in the cDAC yet.

Add a new pipeline leg (cDAC_no_fallback) to runtime-diagnostics.yml
that runs the diagnostics tests with this variable set, giving us
visibility into cDAC completeness.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 10, 2026 16:15
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “cDAC no-fallback” diagnostics test leg and a corresponding runtime switch so diagnostics tests can run with cDAC without delegating unimplemented APIs to the legacy DAC.

Changes:

  • Entrypoints.cs: honors CDAC_NO_FALLBACK=1 by passing null as the legacy DAC implementation to SOSDacImpl.
  • runtime-diagnostics.yml: adds a cDAC_no_fallback job that runs diagnostics tests with useCdac: true and CDAC_NO_FALLBACK=1.

Reviewed changes

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

File Description
src/native/managed/cdac/mscordaccore_universal/Entrypoints.cs Adds an env-var controlled path to disable legacy DAC fallback in CreateSosInterface.
eng/pipelines/runtime-diagnostics.yml Introduces a third diagnostics test leg to run cDAC tests with fallback disabled.

Comment on lines 80 to +88
object? legacyImpl = legacyImplPtr != IntPtr.Zero
? cw.GetOrCreateObjectForComInstance(legacyImplPtr, CreateObjectFlags.None)
: null;

// When CDAC_NO_FALLBACK is set, don't pass the legacy DAC to SOSDacImpl.
// This runs the cDAC standalone without any legacy delegation, exposing
// any APIs that haven't been implemented yet.
if (Environment.GetEnvironmentVariable("CDAC_NO_FALLBACK") == "1")
legacyImpl = null;
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

When CDAC_NO_FALLBACK=1, this method still creates an RCW for legacyImplPtr via GetOrCreateObjectForComInstance and then discards it (the env-var check happens afterward). That can unnecessarily AddRef the legacy COM object and keep it alive until GC/finalization. Consider checking CDAC_NO_FALLBACK before wrapping legacyImplPtr (or gating the RCW creation on the env var) so the legacy implementation is never touched in no-fallback mode.

Suggested change
object? legacyImpl = legacyImplPtr != IntPtr.Zero
? cw.GetOrCreateObjectForComInstance(legacyImplPtr, CreateObjectFlags.None)
: null;
// When CDAC_NO_FALLBACK is set, don't pass the legacy DAC to SOSDacImpl.
// This runs the cDAC standalone without any legacy delegation, exposing
// any APIs that haven't been implemented yet.
if (Environment.GetEnvironmentVariable("CDAC_NO_FALLBACK") == "1")
legacyImpl = null;
// When CDAC_NO_FALLBACK is set, don't pass the legacy DAC to SOSDacImpl.
// This runs the cDAC standalone without any legacy delegation, exposing
// any APIs that haven't been implemented yet.
bool noFallback = Environment.GetEnvironmentVariable("CDAC_NO_FALLBACK") == "1";
object? legacyImpl = !noFallback && legacyImplPtr != IntPtr.Zero
? cw.GetOrCreateObjectForComInstance(legacyImplPtr, CreateObjectFlags.None)
: null;

Copilot uses AI. Check for mistakes.
max-charlamb and others added 2 commits April 10, 2026 21:39
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Handle the CLRDATA_REQUEST_REVISION (0xe0000000) request code directly
instead of delegating to the legacy DAC. Return revision 9 matching the
legacy DAC behavior. This fixes 'Failed to request DacVersion' errors
from ClrMD when running in cDAC no-fallback mode.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 11, 2026 02:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines 616 to +633
int IXCLRDataProcess.Request(uint reqCode, uint inBufferSize, byte* inBuffer, uint outBufferSize, byte* outBuffer)
=> _legacyProcess is not null ? _legacyProcess.Request(reqCode, inBufferSize, inBuffer, outBufferSize, outBuffer) : HResults.E_NOTIMPL;
{
int hr = HResults.S_OK;
try
{
switch (reqCode)
{
case (uint)CLRDataGeneralRequest.CLRDATA_REQUEST_REVISION:
if (inBufferSize != 0 || inBuffer is not null || outBufferSize != sizeof(uint) || outBuffer is null)
return HResults.E_INVALIDARG;
*(uint*)outBuffer = 9;
break;

default:
if (_legacyProcess is not null)
return _legacyProcess.Request(reqCode, inBufferSize, inBuffer, outBufferSize, outBuffer);
return HResults.E_INVALIDARG;
}
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

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

This PR also changes IXCLRDataProcess.Request behavior (adds local handling for CLRDATA_REQUEST_REVISION and changes the no-legacy path from E_NOTIMPL to E_INVALIDARG for other reqCodes), but the PR description only mentions Entrypoints.cs and runtime-diagnostics.yml. Please update the PR description (or add a note) to reflect this additional functional change so reviewers understand why it’s needed for the new test leg.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants