Implement ISOSDacInterface::GetObjectClassName in cDAC SOSDacImpl#124816
Open
Implement ISOSDacInterface::GetObjectClassName in cDAC SOSDacImpl#124816
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
…unit and dump tests Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement ISOSDacInterface::GetObjectClassName in SOSDacImpl.cs
Implement ISOSDacInterface::GetObjectClassName in cDAC SOSDacImpl
Feb 24, 2026
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
Show resolved
Hide resolved
Member
max-charlamb
left a comment
There was a problem hiding this comment.
@copilot , address feedback
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
Outdated
Show resolved
Hide resolved
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
Outdated
Show resolved
Hide resolved
… case, update tests Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Contributor
Author
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Implements the cDAC version of ISOSDacInterface::GetObjectClassName in SOSDacImpl, replacing the legacy-only stub, and adds unit + dump-based tests to validate method-table → type/module resolution and string output behavior.
Changes:
- Add cDAC implementation of
GetObjectClassNameusingIObject,IRuntimeTypeSystem,ILoader, andTypeNameBuilderwith a fallback toDacStreams. - Add unit tests covering zero address, unloaded-type naming, and “null buffer returns needed size” behavior.
- Add dump-based integration tests validating that
System.ObjectandSystem.Stringresolve to modules with loaded image contents.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs | Implements GetObjectClassName in cDAC, including unloaded-module handling, TypeNameBuilder formatting, and DEBUG cross-check vs legacy DAC. |
| src/native/managed/cdac/tests/ObjectTests.cs | Adds unit tests for GetObjectClassName argument handling and unloaded-type naming behavior. |
| src/native/managed/cdac/tests/DumpTests/RuntimeTypeSystemDumpTests.cs | Adds dump tests ensuring Object/String MTs map to modules with loaded image contents via Loader contract. |
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
Show resolved
Hide resolved
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the cDAC version of
ISOSDacInterface::GetObjectClassNameinSOSDacImpl.cs, replacing the legacy-only stub. Based onClrDataAccess::GetObjectClassNameinrequest.cpp, following the established pattern fromGetMethodTableName.Implementation (
SOSDacImpl.cs)IObject.GetMethodTableAddress, then resolves theTypeHandleviaIRuntimeTypeSystem.GetTypeHandle"<Unloaded Type>") and normal types viaTypeNameBuilder.AppendTypewithFormatNamespace | FormatFullInstDacStreams.StringFromEEAddresswhenTypeNameBuilderthrows#if DEBUGvalidation against legacy DACUnit tests (
ObjectTests.cs)GetObjectClassName_ZeroAddress— zero address returns error HResultGetObjectClassName_UnloadedModule— object with unloaded module returns"<Unloaded Type>"(uses Moq to mock IObject, IRuntimeTypeSystem, and ILoader contracts)GetObjectClassName_NullBufferReturnsNeededSize— null buffer still populates needed sizeAll 3 tests run across 4 architectures (32/64-bit × little/big-endian).
Dump tests (
RuntimeTypeSystemDumpTests.cs)RuntimeTypeSystem_ObjectMethodTableHasLoadedModule— verifies System.Object MT → module → loaded image flowRuntimeTypeSystem_StringMethodTableHasLoadedModule— same for System.String✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.