Skip to content

[cDAC] Implement IsThreadSuspendedOrHijacked for cDAC - #131274

Merged
noahfalk merged 2 commits into
dotnet:mainfrom
barosiak:barosiak/IsThreadSuspendedOrHijacked
Jul 24, 2026
Merged

noahfalk merged 2 commits into
dotnet:mainfrom
barosiak:barosiak/IsThreadSuspendedOrHijacked

Conversation

@barosiak

Copy link
Copy Markdown
Member

Summary

Implement IsThreadSuspendedOrHijacked for cDAC.

Changes

  • DacDbiImpl.cs - Implement IsThreadSuspendedOrHijacked.
  • DacDbiThreadDumpTests.cs - Add a test cross-validating the result against the thread contract.

@barosiak barosiak self-assigned this Jul 23, 2026
Copilot AI review requested due to automatic review settings July 23, 2026 15:45
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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

Implements DacDbiImpl.IsThreadSuspendedOrHijacked in the cDAC legacy DBI shim by deriving the result from the Thread contract’s ThreadData.State, and adds a dump-based integration test that cross-validates the DBI result against the contract’s state flags.

Changes:

  • Implement DacDbiImpl.IsThreadSuspendedOrHijacked using IThread.GetThreadData(...).State (DebugSyncSuspended | Hijacked).
  • Add a dump test that iterates threads from ThreadStoreData.FirstThread and asserts DBI == contract for suspended/hijacked.
Show a summary per file
File Description
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs Adds the contract-based implementation of IsThreadSuspendedOrHijacked (with DEBUG cross-check against legacy DAC when present).
src/native/managed/cdac/tests/DumpTests/DacDbi/DacDbiThreadDumpTests.cs Adds a dump integration test to validate IsThreadSuspendedOrHijacked results against the Thread contract state.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

@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 review requested due to automatic review settings July 23, 2026 23:38

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 3 out of 3 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs:4185

  • Avoid using an intentionally-thrown NullReferenceException for the null-output case. This is the only instance in this file that uses exceptions for E_POINTER, and it also makes the GetThreadData call less consistent with nearby thread helpers that explicitly wrap vmThread in a TargetPointer. Prefer setting hr directly when pResult is null, and use new TargetPointer(vmThread) for the contract call.
        {
            if (pResult is null)
                throw new NullReferenceException();

            *pResult = Interop.BOOL.FALSE;

@noahfalk
noahfalk enabled auto-merge (squash) July 24, 2026 00:09
@noahfalk
noahfalk merged commit 13cd8e3 into dotnet:main Jul 24, 2026
71 checks passed
hez2010 pushed a commit to hez2010/runtime that referenced this pull request Jul 26, 2026
### Summary
Implement `IsThreadSuspendedOrHijacked` for cDAC.

### Changes
- `DacDbiImpl.cs` - Implement `IsThreadSuspendedOrHijacked`.
- `DacDbiThreadDumpTests.cs` - Add a test cross-validating the result
against the thread contract.

---------

Co-authored-by: Noah Falk <[email protected]>
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 26, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 26, 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