Add cDAC no-fallback test leg to runtime-diagnostics pipeline#126752
Add cDAC no-fallback test leg to runtime-diagnostics pipeline#126752max-charlamb wants to merge 3 commits intomainfrom
Conversation
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>
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
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: honorsCDAC_NO_FALLBACK=1by passingnullas the legacy DAC implementation toSOSDacImpl.runtime-diagnostics.yml: adds acDAC_no_fallbackjob that runs diagnostics tests withuseCdac: trueandCDAC_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. |
| 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; |
There was a problem hiding this comment.
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.
| 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; |
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>
| 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; | ||
| } |
There was a problem hiding this comment.
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.
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.