Skip to content

[NativeAOT] fix NAOT mappings (follow-up to https://github.com/dotnet/runtime/pull/123333) - #123831

Merged
rcj1 merged 5 commits into
dotnet:mainfrom
rcj1:aot-mapping-fix-2
Feb 3, 2026
Merged

[NativeAOT] fix NAOT mappings (follow-up to https://github.com/dotnet/runtime/pull/123333)#123831
rcj1 merged 5 commits into
dotnet:mainfrom
rcj1:aot-mapping-fix-2

Conversation

@rcj1

@rcj1rcj1 commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

Testing on #122722 revealed some issues with #123333 so I am fixing these here.

After #123333 there remain two error cases:

  1. Our IL offset is greater than the previously found offset, but lower than the max found offset. In this case, we would like to advance the line number in accordance with the new IL offset, which was omitted after [NativeAOT] Source to native mapping fix for out-of-order code #123333.
  2. Our IL offset is greater than the highest IL offset for which there exists a sequence point. In this case, we want to ensure we can create a native <-> line mapping - [NativeAOT] Source to native mapping fix for out-of-order code #123333 had left these IL offsets with a Document of null, meaning no mappings were possible.
    This fixes both of these issues.

Before:
Screenshot 2026-01-30 192451
Screenshot 2026-01-30 192408

After:
Screenshot 2026-01-30 190332
Screenshot 2026-01-30 190613
foo.txt
foo2.txt
New Compressed (zipped) Folder.zip

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

@rcj1
rcj1 requested a review from jkotasJanuary 31, 2026 02:27

CopilotAI 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 refines NativeAOT’s IL-to-native sequence point mapping to close gaps found after #123333, ensuring more accurate source line attribution in stack traces, especially for runtime-async scenarios described in #122722.

Changes:

  • Extend propagation of the last known document/line info across the entire temporary sequencePoints buffer so IL offsets beyond the last explicit sequence point still get a valid document/line mapping.
  • Replace the per-iteration previousIlOffset tracking with a maxIlOffset tracker and adjust the emission condition so sequence points are produced both when backed by PDB info and whenever the IL offset falls within or below the maximum IL offset seen so far, fixing cases where IL offsets re-enter earlier ranges.

@jkotasjkotas 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!

@MichalStrehovsky Could you please take a look as well?

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
CopilotAI review requested due to automatic review settings February 2, 2026 21:58

CopilotAI 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 2 comments.

…lysis/MethodCodeNode.cs
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
CopilotAI review requested due to automatic review settings February 2, 2026 22:26

CopilotAI 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 1 comment.

@rcj1

rcj1 commented Feb 3, 2026

Copy link
Copy Markdown
ContributorAuthor

Hm, I have requested the pipeline be rerun but it is still “neutral” on many runs.

@jkotas

Copy link
Copy Markdown
Member

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkotas

Copy link
Copy Markdown
Member

I have requested the pipeline be rerun but it is still “neutral” on many runs.

There was an infra outage earlier today, the system may be still recovering from it.

@rcj1

rcj1 commented Feb 3, 2026

Copy link
Copy Markdown
ContributorAuthor

/ba-g timeouts

@rcj1
rcj1 merged commit e646a55 into dotnet:mainFeb 3, 2026
118 of 125 checks passed
@rcj1
rcj1 deleted the aot-mapping-fix-2 branch February 3, 2026 15:11
lewing pushed a commit to lewing/runtime that referenced this pull request Feb 9, 2026
…3831)
Testing on dotnet#122722 revealed some issues with dotnet#123333 so I am fixing
these here.
After dotnet#123333 there remain two error cases:
1. Our IL offset is greater than the previously found offset, but lower
than the max found offset. In this case, we would like to advance the
line number in accordance with the new IL offset, which was omitted
after dotnet#123333.
2. Our IL offset is greater than the highest IL offset for which there
exists a sequence point. In this case, we want to ensure we can create a
native <-> line mapping - dotnet#123333 had left these IL offsets with a
Document of null, meaning no mappings were possible.
This fixes both of these issues.
Before:
<img width="1298" height="268" alt="Screenshot 2026-01-30 192451"
src="https://github.com/user-attachments/assets/ab46947f-ea52-4530-949b-3e36bf3b3df6"
/>
<img width="1312" height="359" alt="Screenshot 2026-01-30 192408"
src="https://github.com/user-attachments/assets/b08a8f45-0af2-484a-8392-8d12c3694361"
/>
After:
<img width="1020" height="311" alt="Screenshot 2026-01-30 190332"
src="https://github.com/user-attachments/assets/ac8bca54-6466-4436-9fac-1f6f685e7bd0"
/>
<img width="1030" height="400" alt="Screenshot 2026-01-30 190613"
src="https://github.com/user-attachments/assets/321c8160-cf06-4f43-8c36-352d2bd6908a"
/>
[foo.txt](https://github.com/user-attachments/files/24984632/foo.txt)
[foo2.txt](https://github.com/user-attachments/files/24984633/foo2.txt)
[New Compressed (zipped)
Folder.zip](https://github.com/user-attachments/files/24976959/New.Compressed.zipped.Folder.zip)
---------
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
iremyux pushed a commit to iremyux/dotnet-runtime that referenced this pull request Mar 2, 2026
…3831)
Testing on dotnet#122722 revealed some issues with dotnet#123333 so I am fixing
these here.
After dotnet#123333 there remain two error cases:
1. Our IL offset is greater than the previously found offset, but lower
than the max found offset. In this case, we would like to advance the
line number in accordance with the new IL offset, which was omitted
after dotnet#123333.
2. Our IL offset is greater than the highest IL offset for which there
exists a sequence point. In this case, we want to ensure we can create a
native <-> line mapping - dotnet#123333 had left these IL offsets with a
Document of null, meaning no mappings were possible.
This fixes both of these issues.
Before:
<img width="1298" height="268" alt="Screenshot 2026-01-30 192451"
src="https://github.com/user-attachments/assets/ab46947f-ea52-4530-949b-3e36bf3b3df6"
/>
<img width="1312" height="359" alt="Screenshot 2026-01-30 192408"
src="https://github.com/user-attachments/assets/b08a8f45-0af2-484a-8392-8d12c3694361"
/>
After:
<img width="1020" height="311" alt="Screenshot 2026-01-30 190332"
src="https://github.com/user-attachments/assets/ac8bca54-6466-4436-9fac-1f6f685e7bd0"
/>
<img width="1030" height="400" alt="Screenshot 2026-01-30 190613"
src="https://github.com/user-attachments/assets/321c8160-cf06-4f43-8c36-352d2bd6908a"
/>
[foo.txt](https://github.com/user-attachments/files/24984632/foo.txt)
[foo2.txt](https://github.com/user-attachments/files/24984633/foo2.txt)
[New Compressed (zipped)
Folder.zip](https://github.com/user-attachments/files/24976959/New.Compressed.zipped.Folder.zip)
---------
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Mar 6, 2026
Sign up for freeto 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.

4 participants

@rcj1@jkotas@MichalStrehovsky