Skip to content

Simplify sample profiler native pointer conversion - #136444

Merged
steveisok merged 1 commit into
mainfrom
steveisok-simplify-profiler-pointer-conversion
Oct 25, 2026
Merged

steveisok merged 1 commit into
mainfrom
steveisok-simplify-profiler-pointer-conversion

Conversation

@steveisok

Copy link
Copy Markdown
Member

Summary

Apply Jan's review feedback on the backport of #136433: use IntPtr stack = (nint)address;, since IntPtr and nint are the same type.

This is a one-line, test-only syntax cleanup. The existing sign-extension comment, ulong address representation, and stack-reading logic are unchanged. The project uses unchecked arithmetic by default, so the truncating native-width conversion is preserved. The crash fix is already in #136433; this follow-up does not independently fix it.

The same correction has been pushed to the existing release/11.0 backport #136440 (14b7ddd4f5ba5d5af35afc23e916be80d3d0b9e1) and release/10.0 backport #136441 (d5ce4c1d541740525d038b0b30988058edfe2a89; helper is in GCEvents.cs there).

Validation

  • Evaluated the actual test projects with installed MSBuild on all three branches: CheckForOverflowUnderflow=false for ARM and ARM64 in Debug, Checked, and Release. There is no enclosing checked block around the cast.
  • Built and ran a standalone cast-equivalence probe on ARM64 with .NET 10.0.9 and .NET 11.0.0-preview.6.26322.101. Each run passed 10 native-width vectors and 10 simulated 32-bit narrowing vectors, including the sign-extended high-bit pointer 0xFFFFFFFFD2345678.
  • Old and simplified native casts emit identical IL: ldarg.0; conv.i; ret. A checked-conversion control throws as expected.
  • git diff --check passed on all three branches.

No full runtime rebuild or EventPipe test-harness run was performed. The 32-bit checks were simulated narrowing on ARM64, not actual ARM32 execution. The standalone probe is not part of the PR.

Note

This PR description and change were prepared with GitHub Copilot.

Apply jkotas feedback on the backport of #136433. IntPtr and nint are the same type, and the test project uses unchecked arithmetic by default.

Co-authored-by: Copilot App <[email protected]>
@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.

@steveisok
steveisok requested a review from jkotas October 25, 2026 17:32
@steveisok
steveisok merged commit 0d87832 into main Oct 25, 2026
82 checks passed
@steveisok
steveisok deleted the steveisok-simplify-profiler-pointer-conversion branch October 25, 2026 21:08
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 26, 2026
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.

2 participants