Skip to content

Integrating GetFrameType and SetContext into cDAC - #131608

Open
rcj1 with Copilot wants to merge 1 commit into
mainfrom
copilot/implement-ixclrdatastackwalk
Open

Integrating GetFrameType and SetContext into cDAC#131608
rcj1 with Copilot wants to merge 1 commit into
mainfrom
copilot/implement-ixclrdatastackwalk

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
  • Implement IXCLRStackWalk GetFrameType and SetContext in cDAC
  • The CLRDATA_STACK_WALK_REQUEST_SET_FIRST_FRAME Request is a no-op in the context in which we call it - I have left it not implemented.

Copilot AI review requested due to automatic review settings July 30, 2026 19:02

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

@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.

@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.

…nd SetContext in cDAC

Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 30, 2026 20:37
@rcj1
rcj1 force-pushed the copilot/implement-ixclrdatastackwalk branch from 524701a to a123193 Compare July 30, 2026 20:37
@rcj1
rcj1 marked this pull request as ready for review July 30, 2026 20:43
@rcj1
rcj1 requested review from barosiak, hoyosjs and noahfalk July 30, 2026 20:43
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 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.

Copilot's findings

Comments suppressed due to low confidence (2)

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataStackWalk.cs:67

  • Reseed disposes the current enumerator before creating the replacement. If CreateStackWalk/GetEnumerator throws (e.g., invalid context buffer), the stack walk is left with a disposed _dataFrames enumerator, so subsequent calls can start failing even though SetContext returned an HRESULT. Construct the new enumerator first, then swap and dispose the old one after success (transactional update).
    private void Reseed(byte[] context, bool isFirst)
    {
        _dataFrames.Dispose();
        _dataFrames = _target.Contracts.StackWalk.CreateStackWalk(_threadData, context, isFirst).GetEnumerator();
        _currentFrameIsValid = MoveNextLegacyVisible();
    }

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataStackWalk.cs:306

  • SetContext always forwards to _legacyImpl.SetContext even when the cDAC SetContext path fails (e.g., invalid context buffer). That can desynchronize the legacy stack walk from the cDAC walk for subsequent GetFrame()/Next() calls (and can mutate legacy state even though SetContext returned failure). Only update the legacy stack walk when this method returns S_OK.
        if (_legacyImpl is not null)
        {
            int hrLocal = _legacyImpl.SetContext(contextSize, context);
#if DEBUG
            Debug.ValidateHResult(hr, hrLocal);
  • Files reviewed: 5/5 changed files
  • Comments generated: 1

Comment on lines 231 to 235
int hr = HResults.S_OK;
try
{
if (inBufferSize != 0 || inBuffer != null)
throw new ArgumentException("Invalid input buffer parameters");
switch (reqCode)
{
@rcj1

rcj1 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #112275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants