Uh oh!
There was an error while loading. Please reload this page.
[cDAC] : Implement DacDBI GetThreadHandle and GetThreadAllocInfo - #128388
Conversation
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
This PR extends the cDAC Thread contract and the legacy DacDbi implementation to surface an OS thread handle and to implement IDacDbiInterface::GetThreadHandle / GetThreadAllocInfo using cDAC-backed data.
Changes:
- Add
ThreadHandleto the Thread data descriptor pipeline (CoreCLRcdac_data<Thread>+datadescriptor.inc, managed data reader, contract DTO, and docs). - Implement
DacDbiImpl.GetThreadHandleandDacDbiImpl.GetThreadAllocInfousing theIThreadcontract instead of returningE_NOTIMPL. - Add/adjust tests and mock descriptors to carry the new
ThreadHandlefield.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/ThreadTests.cs | Adds a contract-level test validating ThreadData.ThreadHandle. |
| src/native/managed/cdac/tests/MockDescriptors/MockDescriptors.Thread.cs | Extends the mock Thread layout/view to include a ThreadHandle pointer field. |
| src/native/managed/cdac/tests/ClrDataExceptionStateTests.cs | Updates ThreadData construction sites to include the new ThreadHandle field. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/IDacDbiInterface.cs | Refines COM signature for GetThreadHandle to an output pointer-to-handle shape. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements GetThreadHandle and GetThreadAllocInfo using cDAC contracts (with DEBUG parity checks). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/Thread.cs | Reads the new ThreadHandle field from the Thread type descriptor into the managed data model. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Thread_1.cs | Plumbs ThreadHandle into the ThreadData returned by IThread.GetThreadData. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IThread.cs | Extends the public ThreadData record struct with a new positional ThreadHandle field. |
| src/coreclr/vm/threads.h | Exposes Thread::m_ThreadHandle offset via cdac_data<Thread>. |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Adds ThreadHandle to the Thread data descriptor field list. |
| docs/design/datacontracts/Thread.md | Documents the new ThreadHandle field and descriptor dependency. |
Copilot's findings
- Files reviewed: 11/11 changed files
- Comments generated: 6
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
max-charlamb
commented
May 21, 2026
Should the native Dbi GetThreadHandle be updated for this new behavior (returning 0 on non-windows platforms)? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
max-charlamb
left a comment
There was a problem hiding this comment.
looks reasonable. small nit regarding documenting that this API is not x-bitness safe
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
rcj1
commented
May 22, 2026
/ba-g tests already ran, nit comment change |
rcj1
commented
May 22, 2026
/ba-g nit comment change, tests already ran |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rcj1
commented
May 22, 2026
/ba-g nit comment, already ran tests |
Implement DacDBI GetThreadHandle and GetThreadAllocInfo. No new contracts.