Repository navigation
Description
Description
Managed ilasm changes the array-shape metadata emitted for an existing IL input when a dimension with an unspecified size precedes a dimension with a specified size.
For int32[2...,0...8], the native-ilasm behavior expected by the existing TypeSystem tests is sizes [0,9] and lower bounds [2,0]. The updated managed ilasm instead emits no sizes, retaining only the lower bounds. This loses the explicitly supplied second dimension size and breaks compatibility with the native assembler.
@jkoritzinsky, could you take a look? This is separate from the preprocessor regression tracked in #137424.
Reproduction Steps
Use the source at 65ed449e5aeb93ee8b91680669536098d3aaaf26 from #137416, which consumes Microsoft.NET.Sdk.IL / Microsoft.NETCore.ILAsm version 12.0.0-alpha.1.26561.116.
Build and run src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj, particularly TypeSystemTests.SignatureTests.TestSignatureMatchesForArrayShapeDetails.
Its IL fixture, src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/Signature.il, declares:
.method public hidebysig instance int32 modopt([CoreTestAssembly]System.Void) [3,1 ... 4] Method4(int32 modopt(FooModifier)[2 ...,0...8], int32 modopt(FooModifier)[0...,...], int32 [,,,]) cil managed
{
ret
}The first parameter's first dimension has lower bound 2 and unspecified size; its second dimension has lower bound 0 and size 9.
CI evidence: CLR tools build 1677798. The same failure was reproduced locally on macOS ARM64 with the updated package.
Expected behavior
Preserve the native-ilasm array-shape encoding: rank 2, sizes [0,9], lower bounds [2,0].
The signature format stores sizes for a contiguous prefix of dimensions. The native behavior fills the unspecified first size with zero so the explicitly specified later size can be retained.
Actual behavior
The managed assembler emits rank 2, an empty sizes list, and lower bounds [2,0].
The unchanged test assertion reports:
Expected: ...ArrayShape1.2.2.1|0,9|2,0<null>...
Actual: ...ArrayShape1.2.2.1||2,0<null>...
Regression?
This is a compatibility difference from the native assembler's encoding recorded by the existing test. It surfaced with the managed-ilasm package update in #137416. A separate local old-package/new-package byte-for-byte comparison has not been performed.
Known Workarounds
Spell out the first dimension's zero size explicitly:
int32[2...1,0...8]The first dimension then has size 1 - 2 + 1 = 0, allowing both sizes to be encoded. With this fixture change, the existing signature assertions are unchanged and all 356 TypeSystem tests pass locally. This preserves the array-shape metadata previously expected by the test; it is a workaround, not an assembler fix.
Configuration
Observed in Linux x64 CI and reproduced on macOS ARM64 with Microsoft.NET.Sdk.IL / Microsoft.NETCore.ILAsm 12.0.0-alpha.1.26561.116.
Other information
GrammarActions.WriteArrayShape counts sizes only while each leading dimension has a non-null Upper value. For this input the first size is unspecified, so sizeCount stays zero and the later explicit size is discarded.
Note
This issue was generated by GitHub Copilot from CI evidence, source inspection, and local reproduction.
Activity
dotnet-policy-service commentedon Nov 12, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Nov 12, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib
See info in area-owners.md if you want to be subscribed.
Make array signature fixture sizes explicit