Skip to content

Preserve later array dimensions in managed ILAsm - #137439

Merged
jkoritzinsky merged 3 commits into
dotnet:mainfrom
jkoritzinsky:dev/jkoritzinsky/ilasm-array-shape-size-fix
Nov 14, 2026
Merged

jkoritzinsky merged 3 commits into
dotnet:mainfrom
jkoritzinsky:dev/jkoritzinsky/ilasm-array-shape-size-fix

Conversation

@jkoritzinsky

Copy link
Copy Markdown
Member

Summary

  • Preserve later array sizes and lower bounds by zero-filling unspecified dimensions through the last specified entry, matching native ILAsm.
  • Add exact metadata regression cases covering leading, middle, and trailing gaps, explicit zero sizes, and negative lower bounds.

Validation

  • .\dotnet.cmd build src\tools\ilasm\src\ILAssembler\ILAssembler.csproj -p:NuGetAudit=false — passed for net10.0, net11.0, and net472.
  • .\dotnet.cmd test src\tools\ilasm\tests\ILAssembler.Tests\ILAssembler.Tests.csproj -p:NuGetAudit=false — passed 5,323 tests on each of net10.0 and net11.0; six new cases failed per framework before the fix.
  • Compared all 12 new shape signatures byte-for-byte against native ILAsm — matched.
  • .\dotnet.cmd vstest artifacts\bin\ILCompiler.TypeSystem.Tests\x64\Debug\ILCompiler.TypeSystem.Tests.dll — passed all 356 tests with the unchanged IL fixture reassembled by the patched managed compiler.

Resolves #137435

Note

This pull request was generated with GitHub Copilot.

Zero-fill size and lower-bound gaps through the last specified dimension, matching native ILAsm array-shape metadata. Add exact signature regression coverage for mixed specified and unspecified dimensions.

Co-authored-by: Copilot App <[email protected]>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib
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.

🟢 Approval recommended

The array-shape encoding fix has no active review issues blocking approval.

No open issues 🎉

What changed in this PR

This PR fixes managed ILAsm array-shape encoding so unspecified dimensions no longer cause later sizes or lower bounds to be omitted, aligning the output with native ILAsm.

Changes:

  • Encode sizes and lower bounds through their respective last specified dimension, zero-filling intervening gaps.
  • Add 12 metadata regression cases covering leading, middle, and trailing gaps, explicit zero sizes, and negative lower bounds.
File Description
src/​tools/​ilasm/​tests/​ILAssembler.Tests/​TypeSignatureTests.cs Adds exact array-shape metadata assertions for 12 boundary cases.
src/​tools/​ilasm/​src/​ILAssembler/​Actions/​GrammarActions.Signatures.Types.cs Preserves later array dimensions by computing each prefix through its last specified entry.

Review effort: Balanced

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) November 12, 2026 19:44
@jkoritzinsky
jkoritzinsky requested a review from jkotas November 12, 2026 19:44
@jkoritzinsky
jkoritzinsky merged commit f026223 into dotnet:main Nov 14, 2026
60 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Nov 14, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Managed ilasm drops later array dimension sizes after an unspecified size

3 participants