Closed
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 updates the cDAC DacDbi implementation to better match native DAC behavior for value-type classification, current-exception retrieval, and generic-variable detection, and adjusts the related contract surface and tests.
Changes:
- Add
IRuntimeTypeSystem.IsValueTypeand implement it inRuntimeTypeSystem_1(method-table flags + typedesc fallback). - Implement
DacDbiImpl.GetCurrentExceptionvia the Thread contract’s current-exception handle API. - Fix native
MethodTable::ContainsGenericVariablesto return a properBOOL(0/1), aligningHasTypeParamsbehavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/DumpTests/DacDbi/DacDbiThreadDumpTests.cs | Updates dump-based test expectations for GetCurrentException. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Switches DacDbi GetCurrentException to use Thread contract handle API; updates IsValueType to call RTS. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/RuntimeTypeSystemHelpers/MethodTableFlags_1.cs | Adds helper flag/property for detecting value types from method table flags. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs | Implements IsValueType(TypeHandle) in the RuntimeTypeSystem contract implementation. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IThread.cs | Removes obsolete GetThrowableObject API from the Thread contract abstraction. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeTypeSystem.cs | Adds IsValueType(TypeHandle) to the RuntimeTypeSystem contract abstraction. |
| src/coreclr/vm/methodtable.h | Normalizes ContainsGenericVariables return type/value to true BOOL semantics (0/1). |
| docs/design/datacontracts/RuntimeTypeSystem.md | Documents the new IsValueType RTS API. |
|
|
||
| public bool HasComponentSize => GetFlag(WFLAGS_HIGH.HasComponentSize) != 0; | ||
| public bool IsInterface => GetFlag(WFLAGS_HIGH.Category_Mask) == WFLAGS_HIGH.Category_Interface; | ||
| public bool IsValueType => GetFlag(WFLAGS_HIGH.Category_Mask) == WFLAGS_HIGH.Category_ValueType; |
Comment on lines
147
to
154
| TargetPointer current = storeData.FirstThread; | ||
| Assert.NotEqual(TargetPointer.Null, current); | ||
|
|
||
| ulong exception; | ||
| int hr = dbi.GetCurrentException(current, &exception); | ||
|
|
||
| // GetCurrentException depends on Thread.GetThrowableObject which is not yet | ||
| // implemented in the Thread contract. Skip until the contract is available. | ||
| if (hr == unchecked((int)0x80004001)) // E_NOTIMPL — GetThrowableObject not yet in Thread contract | ||
| { | ||
| throw new SkipTestException("GetThrowableObject not yet implemented in Thread contract"); | ||
| } | ||
|
|
||
| Assert.Equal(System.HResults.S_OK, hr); | ||
| Assert.NotEqual(0ul, exception); | ||
| } |
Comment on lines
+528
to
529
| TargetPointer throwable = _target.Contracts.Thread.GetCurrentExceptionHandle(new TargetPointer(vmThread)) | ||
| *pRetVal = throwable.Value; |
This was referenced Apr 16, 2026
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.
ValueTypeflag on MethodTablesHasTypeParams- DAC was returning the value of a flag, cDAC was returning 1/0. Fixed native impl to return 1/0.