Skip to content

[cDAC] Remove GetObjectContents from DAC/DBI - #128615

Merged
barosiak merged 5 commits into
dotnet:mainfrom
barosiak:barosiak/GetObjectContents
Jun 2, 2026
Merged

barosiak merged 5 commits into
dotnet:mainfrom
barosiak:barosiak/GetObjectContents

Conversation

@barosiak

@barosiak barosiak commented May 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Remove GetObjectContents from the DAC/DBI interface. The caller in divalue.cpp is replaced with a direct VmPtrToCookie cast, making the DAC method redundant.

Changes

  • Remove native implementation in dacdbiimpl.cpp
  • Remove from IDacDbiInterface, dacdbi.idl and mentions in comments.
  • Remove cDAC managed DacDbi wrapper

@barosiak barosiak self-assigned this May 27, 2026
Copilot AI review requested due to automatic review settings May 27, 2026 00:25
@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 extends the cDAC object contract with a size query API and uses it to implement DacDbiImpl.GetObjectContents, with accompanying documentation and unit tests to validate the new behavior across architectures.

Changes:

  • Added GetObjectSize(TargetPointer address) to the IObject contract and implemented it in Object_1.
  • Implemented DacDbiImpl.GetObjectContents using the contract-reported object size, with DEBUG parity validation against the legacy DAC.
  • Added unit tests for GetObjectSize (plain objects + arrays) and GetObjectContents, plus updated the Object contract design doc.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IObject.cs Adds new GetObjectSize method to the public Object contract interface.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Object_1.cs Implements object size calculation based on base size and component count/size.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs Implements GetObjectContents by returning { address, size } from cDAC.
src/native/managed/cdac/tests/ObjectTests.cs Adds unit tests for GetObjectSize on plain objects and arrays across architectures.
src/native/managed/cdac/tests/DacDbiImplTests.cs Adds unit test for GetObjectContents across architectures using a mocked Object contract.
docs/design/datacontracts/Object.md Documents the new GetObjectSize API and its pseudocode.

Copilot AI review requested due to automatic review settings May 28, 2026 21:31

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread docs/design/datacontracts/Object.md Resolved
Comment thread docs/design/datacontracts/Object.md Resolved
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings May 28, 2026 22:11
@barosiak
barosiak requested a review from rcj1 May 28, 2026 22:12

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking at the caller for GetObjectContents() it appears to be doing a whole bunch of unnecessary work to effectively implement just a type cast. I think we'd be better off simplifying by getting rid of the API rather than porting it.

@rcj1

rcj1 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Looking at the caller for GetObjectContents() it appears to be doing a whole bunch of unnecessary work to effectively implement just a type cast. I think we'd be better off simplifying by getting rid of the API rather than porting it.

I agree, when I tried to remove GetObjectContents I tried to work around needing the type cast at all. Given that this is a cast from VMPTR to CORDB_ADDRESS and not the other way around, I think this is a good idea.

@barosiak barosiak changed the title [cDAC] Implement GetObjectContents for cDAC [cDAC] Remove GetObjectContents May 29, 2026
@barosiak barosiak changed the title [cDAC] Remove GetObjectContents [cDAC] Remove GetObjectContents from DAC/DBI May 29, 2026
@barosiak
barosiak requested a review from noahfalk May 29, 2026 21:16

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@barosiak

barosiak commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

/ba-g failures unrelated to changes

@barosiak
barosiak merged commit 4a662a9 into dotnet:main Jun 2, 2026
126 of 128 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 3, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 3, 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.

5 participants