[cDAC] Compute MethodDesc size directly to support more heap dump scenarios#124772
Merged
max-charlamb merged 4 commits intodotnet:mainfrom Feb 24, 2026
Merged
[cDAC] Compute MethodDesc size directly to support more heap dump scenarios#124772max-charlamb merged 4 commits intodotnet:mainfrom
max-charlamb merged 4 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modifies how MethodDesc sizes are computed in the cDAC RuntimeTypeSystem contract to support heap dumps. Previously, the code read from the runtime's s_ClassificationSizeTable global, which is not available in heap dumps. The new implementation computes the MethodDesc size directly from data descriptor type sizes, mirroring the runtime's size table logic but using only metadata that's available in heap dumps.
Changes:
- Replaced runtime table lookup with data-descriptor-based size computation for MethodDesc instances
- Added AsyncMethodData data type for computing optional slot sizes
- Changed TypeHierarchy test debuggee to use heap dumps instead of full dumps for verification
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| RuntimeTypeSystem_1.cs | Reimplemented ComputeSize method to calculate MethodDesc size from data descriptor sizes instead of reading s_ClassificationSizeTable |
| Constants.cs | Removed MethodDescSizeTable global constant that's no longer needed |
| DataType.cs | Added AsyncMethodData enum value for the async method data slot |
| datadescriptor.inc | Added AsyncMethodData data descriptor and removed MethodDescSizeTable global |
| MockDescriptors.MethodDescriptors.cs | Updated mock tests to remove dummy MethodDescSizeTable and add AsyncMethodData type info |
| RuntimeTypeSystemDumpTests.cs | Removed DumpType override to use default "heap" dumps |
| TypeHierarchy.csproj | Changed dump type from "Full" to "Heap" |
| RuntimeTypeSystem.md | Updated documentation to reflect new size computation approach and removed MethodDescSizeTable global |
...ged/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs
Outdated
Show resolved
Hide resolved
...ged/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs
Outdated
Show resolved
Hide resolved
...ged/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs
Outdated
Show resolved
Hide resolved
...ged/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs
Outdated
Show resolved
Hide resolved
- Use DataType.CLRToCOMCallMethodDesc for ComInterop classification - Use DataType.NonVtableSlot instead of target.PointerSize - Use DataType.NativeCodeSlot instead of target.PointerSize - Fix error message typo: AsyncMethodDescData -> AsyncMethodData Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
noahfalk
approved these changes
Feb 24, 2026
hoyosjs
approved these changes
Feb 24, 2026
iremyux
pushed a commit
to iremyux/dotnet-runtime
that referenced
this pull request
Mar 2, 2026
…narios (dotnet#124772) Modifies how MethodDesc sizes are computed. Instead of using the runtime `s_ClassificationSizeTable` which is not present in heap dumps, RuntimeTypeSystem now computes the MethodDesc size from datadescriptors. Modified DumpTests to run on heap dumps for verification.
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.
Modifies how MethodDesc sizes are computed. Instead of using the runtime
s_ClassificationSizeTablewhich is not present in heap dumps, RuntimeTypeSystem now computes the MethodDesc size from datadescriptors.Modified DumpTests to run on heap dumps for verification.