Skip to content

[WIP] Implement delegate inspection DacDbi APIs on cDAC#128784

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/delegate-inspection-apis
Draft

[WIP] Implement delegate inspection DacDbi APIs on cDAC#128784
Copilot wants to merge 1 commit into
mainfrom
copilot/delegate-inspection-apis

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

Implements GetDelegateFunctionData and GetDelegateTargetObject in the managed cDAC DacDbi layer, on top of cherry-picked native commit 86d4004 which removes GetDelegateType and simplifies the two delegate APIs' signatures.

cDAC contract

  • New IObject.GetDelegateInfo(addr, out methodPtr, out methodPtrAux, out invocationCount) implemented in Object_1 via a new Data.Delegate type. No version bump; no compat shims for older dumps.

Data descriptors

  • cdac_data<DelegateObject> template + friend in src/coreclr/vm/object.h.
  • New Delegate type in datadescriptor.inc with Target, MethodPtr, MethodPtrAux, InvocationList, InvocationCount.
  • DataType.Delegate enum value.

DacDbi cDAC implementations

  • DacDbiImpl.GetDelegateFunctionData / GetDelegateTargetObject implemented using the new contract + ExecutionManager, RuntimeTypeSystem, and Loader contracts. Delegate-kind branching (closed / open / multicast / wrapper) mirrors the native logic.
  • Both follow the standard cDAC pattern: try/catch translating exceptions to HRs, plus #if DEBUG validation against the legacy implementation (Debug.ValidateHResult + Debug.Assert on outputs).
  • Added CORDBG_E_UNSUPPORTED_DELEGATE HR constant.
  • Vtable slot for the removed GetDelegateType is dropped in IDacDbiInterface.cs to match the native interface.

Native fix-up

  • Fixed missing HRESULT declaration at divalue.cpp:2725 introduced by the cherry-pick.

Unit tests

  • MockDelegateObjectData + AddDelegateObject helpers in MockDescriptors.Object.cs.
  • Four ObjectTests cases for GetDelegateInfo: closed delegate, open delegate, multicast delegate, and null-address argument validation.

Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 29, 2026 21:43
@rcj1 rcj1 added the NO-REVIEW Experimental/testing PR, do NOT review it label May 29, 2026
@rcj1 rcj1 changed the title Implement delegate inspection DacDbi APIs on cDAC [WIP] Implement delegate inspection DacDbi APIs on cDAC May 29, 2026
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Diagnostics-coreclr NO-REVIEW Experimental/testing PR, do NOT review it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants