Skip to content

[cDAC] Mark unused APIs E_NOTIMPL and remove fallback - #130942

Merged
max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:dev/max-charlamb/direct-enotimpl-fallbacks
Jul 20, 2026
Merged

max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:dev/max-charlamb/direct-enotimpl-fallbacks

Conversation

@max-charlamb

Copy link
Copy Markdown
Member

Replace selected cDAC Legacy wrapper fallbacks with direct E_NOTIMPL returns.

This narrows legacy-DAC delegation for unsupported APIs while preserving existing cDAC implementations and coherent enumeration behavior.

Note

This pull request description was generated with GitHub Copilot.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f2aa5dc4-0c99-43f0-af14-734143849c4a
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@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.

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 reduces cDAC Legacy “fallback-to-legacy-DAC” behavior by changing a set of delegation-only wrapper methods to return HResults.E_NOTIMPL directly, narrowing the surface area that can route to the legacy DAC implementation.

Changes:

  • Replaces legacy-fallback delegation with unconditional E_NOTIMPL for selected IXCLRDataProcess, ISOSDacInterface, and IXCLRData* wrapper methods.
  • Removes now-unneeded legacy interface caching (IXCLRDataFrame2 cast field) after disabling delegation for that method set.

Reviewed changes

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

Show a summary per file
File Description
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.IXCLRDataProcess.cs Stops delegating several IXCLRDataProcess APIs (tasks/assemblies/notifications/etc.) to the legacy DAC, returning E_NOTIMPL instead.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs Stops delegating selected ISOSDacInterface APIs (assembly location, DAC module handle, failed assembly APIs, GC handle enum-for-GC, heap alloc data) to the legacy DAC.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataTask.cs Disables legacy delegation for several IXCLRDataTask APIs by returning E_NOTIMPL.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataStackWalk.cs Disables legacy delegation for selected IXCLRDataStackWalk APIs (GetFrameType, SetContext, SetContext2).
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataModule.cs Disables legacy delegation for selected IXCLRDataModule enumeration and lookup APIs by returning E_NOTIMPL.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataMethodInstance.cs Disables legacy delegation for selected IXCLRDataMethodInstance APIs by returning E_NOTIMPL.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataMethodDefinition.cs Disables legacy delegation for selected IXCLRDataMethodDefinition APIs by returning E_NOTIMPL.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataFrame.cs Disables legacy delegation for selected IXCLRDataFrame/IXCLRDataFrame2 APIs and removes the unused cached IXCLRDataFrame2 legacy cast.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataAppDomain.cs Disables legacy delegation for selected IXCLRDataAppDomain APIs by returning E_NOTIMPL.

@max-charlamb
max-charlamb marked this pull request as ready for review July 17, 2026 15:16
@max-charlamb max-charlamb changed the title Stop delegating selected unused cDAC Legacy APIs to the legacy DAC [cDAC] Mark unused APIs E_NOTIMPL and remove fallback Jul 17, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

github-actions Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow state for the Holistic Review Orchestrator.

{
  "version": 5,
  "last_dispatched_commit": "002ad73938f3f0dd2611f4f9810399d00612293b",
  "last_dispatched_base_ref": "main",
  "last_dispatched_base_sha": "509acfd47f3cbbaeddb6a49edadaedb8fdfdf9ad",
  "last_reviewed_commit": "002ad73938f3f0dd2611f4f9810399d00612293b",
  "last_reviewed_base_ref": "main",
  "last_reviewed_base_sha": "509acfd47f3cbbaeddb6a49edadaedb8fdfdf9ad",
  "last_recorded_worker_run_id": "29687167165",
  "review_attempt_commit": "",
  "review_attempt_base_ref": "",
  "review_attempt_count": 0,
  "max_review_attempts": 5,
  "review_history_format": "holistic-review-disclosure-v1",
  "review_history": [
    {
      "commit": "002ad73938f3f0dd2611f4f9810399d00612293b",
      "review_id": 4730765878
    }
  ]
}

@github-actions github-actions Bot 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.

Holistic Review

Motivation: The cDAC Legacy layer wraps each unmanaged IXCLRData*/ISOSDacInterface method, and for methods the cDAC does not implement it delegated to the legacy DAC via LegacyFallbackHelper.CanFallback() && _legacyImpl is not null ? _legacyImpl.Method(...) : E_NOTIMPL. For a selected set of APIs the team wants to stop delegating to the legacy DAC entirely, so that unsupported surface is explicitly unimplemented rather than silently backed by the old DAC. This tightens the boundary of what the cDAC actually stands behind.

Approach: Selected delegating expression bodies are replaced with a direct => HResults.E_NOTIMPL, dropping the CanFallback/_legacyImpl conditional for those specific methods. The change is purely mechanical and confined to the wrapper files; methods that already have real cDAC implementations, and delegating methods the team still wants to keep falling back (e.g. Request, StartEnumModules, GetAddressType, various enum helpers), are left untouched. In ClrDataFrame, the _legacyImpl2 field becomes unused after converting GetExactGenericArgsToken and is correctly removed along with its constructor assignment.

Summary: LGTM. The diff is a clean, well-scoped narrowing of legacy-DAC delegation. I verified the removed _legacyImpl2 field has no remaining references, and that the retained _legacyImpl/_legacyProcess/_legacyModule fields are still used by the many methods that continue to delegate, so no unused-field warnings are introduced. The behavioral effect is intentional: the converted APIs now return E_NOTIMPL unconditionally instead of forwarding to the legacy DAC when present. This is a deliberate design decision consistent with the PR's stated goal; consumers (SOS/debuggers) that previously relied on legacy fallback for these specific methods will now receive E_NOTIMPL, which is the intended contract. No correctness, safety, or performance concerns found in the changed lines, and I have no actionable findings.

Note

This review was generated by this repository's Holistic Review agentic workflow to complement the built-in Copilot review.

Generated by Holistic Review · 67.1 AIC · ⌖ 20 AIC · ⊞ 10K

@max-charlamb
max-charlamb merged commit 14c2569 into dotnet:main Jul 20, 2026
89 checks passed
@max-charlamb
max-charlamb deleted the dev/max-charlamb/direct-enotimpl-fallbacks branch July 20, 2026 16:15
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants