Skip to content

[Diagnostics] Avoid resolving IL offsets for framed crash frames - #131481

Merged
mdh1418 merged 3 commits into
dotnet:mainfrom
mdh1418:inproc_crash_reporter_skip_il_offset_for_framed_frames
Jul 29, 2026
Merged

mdh1418 merged 3 commits into
dotnet:mainfrom
mdh1418:inproc_crash_reporter_skip_il_offset_for_framed_frames

Conversation

@mdh1418

@mdh1418 mdh1418 commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

FIxes #131517

#131273 avoided calling CrawlFrame::GetRelOffset() for framed crash-report stack frames. However, the reporter still attempted to resolve an IL offset for those frames.

A native SIGSEGV during a managed P/Invoke transition produced a framed CrawlFrame where:

• the MethodDesc represented the managed P/Invoke method;
• the instruction pointer was inside the native function that faulted.

Passing that pair to GetILOffsetFromNative triggered this Checked-build assertion:

g_pEEInterface->GetNativeCodeMethodDesc(startAddr) == fd

This change only resolves native and IL offsets for frameless frames, where the stack walker has valid managed  EECodeInfo . This includes faulted frameless frames. Framed transition frames still retain their method, module, and token information, but report native and IL offsets of zero.

Testing

Validated real macOS arm64 in-proc crash reports in both Checked and Release builds, including a native SIGSEGV triggered through P/Invoke.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 4e8cbca3-06b0-4e48-9159-71608830cb0d
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 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: @agocke
See info in area-owners.md if you want to be subscribed.

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

This PR tightens in-proc crash reporter stack-walk frame processing so native and IL offset resolution is only attempted when the CrawlFrame represents non-faulted, frameless managed code, avoiding offset-resolution asserts for framed transition/crash frames.

Changes:

  • Introduces a single gate (hasManagedNativeCode) to decide whether GetRelOffset() is safe/meaningful for the current frame.
  • Uses the same gate to skip GetILOffsetFromNative(...) for frames that don’t represent JIT-managed code at the current IP.

Copilot AI review requested due to automatic review settings July 28, 2026 17:33

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

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 13d168eb-c2c9-410e-b5fb-be2637ac4e9a
Copilot AI review requested due to automatic review settings July 29, 2026 14:29

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

@lateralusX lateralusX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mdh1418
mdh1418 merged commit 930fa98 into dotnet:main Jul 29, 2026
110 checks passed
@mdh1418
mdh1418 deleted the inproc_crash_reporter_skip_il_offset_for_framed_frames branch July 29, 2026 18:12
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 29, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 29, 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.

In-proc crash reporter asserts when resolving IL offset for framed P/Invoke transition

4 participants