Skip to content

DataTargetWrapper: expose ICLRSymbolProvider.TryGetFieldOffset via CCW#5916

Merged
max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:max-charlamb/symbolprovider-fieldoffset-vtable
Jul 7, 2026
Merged

DataTargetWrapper: expose ICLRSymbolProvider.TryGetFieldOffset via CCW#5916
max-charlamb merged 1 commit into
dotnet:mainfrom
max-charlamb:max-charlamb/symbolprovider-fieldoffset-vtable

Conversation

@max-charlamb

@max-charlamb max-charlamb commented Jul 7, 2026

Copy link
Copy Markdown
Member

PR #5899 added HostSymbolProvider.TryGetFieldOffset as the managed implementation of the third ICLRSymbolProvider method, but the corresponding CCW built by DataTargetWrapper was not updated. The interface's vtable still only advertises two methods (TryGetSymbolName, TryGetSymbolAddress).

PR dotnet#5899 added HostSymbolProvider.TryGetFieldOffset as the managed
implementation for the third ICLRSymbolProvider method, but the CCW
built by DataTargetWrapper still only advertises TryGetSymbolName and
TryGetSymbolAddress. Any managed consumer that QIs for the interface
and calls the third slot dereferences an unallocated vtable entry,
which manifests as a native access violation instead of E_NOTIMPL.

Register the missing method on the vtable and forward it to
IClrSymbolProvider.TryGetFieldOffset, mirroring the shape of the
existing TryGetSymbolAddress forwarder.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 7, 2026 03:01
@max-charlamb max-charlamb requested a review from a team as a code owner July 7, 2026 03:01

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 pull request fixes the ICLRSymbolProvider COM Callable Wrapper (CCW) exposed by SOS.Hosting.DataTargetWrapper so its vtable matches the managed interface shape after PR #5899 added the third method (TryGetFieldOffset). This prevents native consumers from dereferencing a missing vtable slot when calling the third method via the ICLRSymbolProvider IID.

Changes:

  • Registers TryGetFieldOffset as the third method in the ICLRSymbolProvider vtable for DataTargetWrapper.
  • Implements the TryGetFieldOffset CCW forwarder and delegates it to IClrSymbolProvider.TryGetFieldOffset, with consistent HRESULT behavior (E_INVALIDARG, E_NOTIMPL, E_FAIL, S_OK).
  • Adds the corresponding unmanaged delegate signature with correct string marshalling (LPWStr).

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

@max-charlamb max-charlamb requested a review from rcj1 July 7, 2026 03:03
@max-charlamb max-charlamb merged commit a7ff61a into dotnet:main Jul 7, 2026
20 checks passed
@max-charlamb max-charlamb deleted the max-charlamb/symbolprovider-fieldoffset-vtable branch July 7, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants