You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: (bug) Copying a struct larger than 64 KiB silently drops fields past the 64 KiB mark #133581
usingSystem;usingSystem.Runtime.CompilerServices;usingSystem.Runtime.InteropServices;[StructLayout(LayoutKind.Explicit,Size=65600)]structBig{[FieldOffset(0)]publicintHead;[FieldOffset(65592)]publicobjectO;// one GC slot, past 64 KiB}classHolder{publicBigB;}classProgram{[MethodImpl(MethodImplOptions.NoInlining|MethodImplOptions.AggressiveOptimization)]staticvoidTest(Holderh){Bigb=default;b.Head=42;b.O="payload";h.B=b;}staticvoidMain(){varh=newHolder();Test(h);Console.WriteLine($"{h.B.Head}, {h.B.O??"<null>"}");}}
Expected
42, payload
Actual
42, <null>
A Checked build also asserts while jitting Test:
Assertion failed 'lclOffs <= UINT16_MAX' in 'Program:Test(Holder)' during 'Lowering nodeinfo'
The struct copy loses anything stored beyond offset 65535, so the reference field arrives as null;
a ref Big destination loses it the same way. Structs this large are legal C#.
Platform
Windows x64, .NET 11 (dotnet/runtime main @ a0b86b1). Reproduces on Checked and Release builds
with DOTNET_TieredCompilation=0.
Activity
dotnet-policy-service commentedon Sep 10, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
EgorBo commentedon Sep 18, 2026
Affected SDK versions:
JIT: copy large local structs through their address when decomposing (#…