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
.NET 12 wasm: System.OverflowException: Arithmetic operation resulted in an overflow #134015
I am running .NET 12 wasm in the following modes: mono, CoreCLR, and CoreCLR R2R. CoreCLR R2R fails to load.
This is what I see:
System.OverflowException: Arithmetic operation resulted in an overflow.
at ILCompiler.DependencyAnalysis.ReadyToRun.InliningInfoNode.GetData(...)
InliningInfoNode.cs:line 203
NETSDK1096: Optimizing assemblies for performance failed.
I reduced this to one assembly and bounded the first bad daily.
Reproduction
The exact failing dotnet-inspect head is 469e912b6.
Publishing its Inspect Web CoreCLR R2R variant with 12.0.100-alpha.1.26472.116 leaves 96 of 97 expected R2R outputs. The only
missing output is DotnetInspect.Web.Core.dll.
Replaying Crossgen2 directly for that linked assembly and the publish reference
closure reproduces the same exception:
Emitting R2R Wasm file: DotnetInspect.Web.Core.dll
Error: Arithmetic operation resulted in an overflow.
System.OverflowException: Arithmetic operation resulted in an overflow.
at ILCompiler.DependencyAnalysis.ReadyToRun.InliningInfoNode.GetData(...)
crossgen2 --make-repro-path produced a standalone 14 MB repro bundle, and
running its generated repro.rsp reproduces the exception independently of
MSBuild. The bundle SHA-256 is eb5a78987847bf04a8a648e095cb00a3a46acba79a4598a4290fb5718621c30b.
Boundary
The same generated repro gives:
Crossgen2
VMR
Result
12.0.0-alpha.1.26462.105
c8c7ac15e5a07158cc2d5199d25d1840eaadf18e
pass
12.0.0-alpha.1.26463.105
9da2930951f4498751b02ecf8546f6bde759ef9d
pass
12.0.0-alpha.1.26464.107
b7e93309a78d453a032ddeb4c13ad57e5e6dffa8
overflow
12.0.0-alpha.1.26464.120
2577879ab57d812ff130a476b34c717a1276adf3
overflow
12.0.0-alpha.1.26465.115
b2f96bd7ac75c07fb8067c05c54767d3d5e12e8d
overflow
12.0.0-alpha.1.26468.106
1c1ae5d3edc93742cdcb2311db6d480723c16033
overflow
12.0.0-alpha.1.26472.116
0cfd699c3d0ad1d7054f237ccfbbb509b9d1c1e5
overflow
The first bad VMR is dotnet/dotnet#9263. Its runtime codeflow is 3d267058...edd70ca5. InliningInfoNode.cs itself is unchanged across the last-known-good and failing
VMRs.
The repro requires the WebAssembly SDK's --opt-cross-module:* argument:
Removing --opt-cross-module:* succeeds and emits the R2R Wasm file.
Keeping cross-module optimization but adding --strip-inlining-info also
succeeds.
That narrows the failure to cross-module inlining-info construction or
serialization rather than general Wasm code generation. The first-bad runtime
range includes #133146, but I have not isolated the regression to
that PR.
I have the Crossgen2-generated bundle locally; GitHub's programmatic attachment
endpoint rejects ZIPs, so I can transfer it through another channel if useful.
I reproduced this locally from the public dotnet-inspect repo at 469e912b6 with 12.0.100-alpha.1.26472.116, so the repro bundle isn't needed. Thanks for narrowing it down to one assembly and the --opt-cross-module:* / --strip-inlining-info behavior; that made it quick to pin down.
The cause is in crossgen2's cross-module inlining info. When the runtime-async variant of a cross-module generic is compiled into the image and inlines another method (here, the async variant of Task<Completion<...>>.WaitAsync(CancellationToken) inlining TimeProvider.get_System()), the compiler records the Check_IL_Body fixup for the async variant. The inlining info writer then looked up the fixup for the plain EcmaMethod instead. That import was never placed, so its index was unset and the checked cast overflowed.
It comes from the async inlining change in #125472; #133146 probably just changed codegen enough to produce this case in your app. The bug isn't Wasm-specific, but browser CoreCLR R2R hits it first because it passes --opt-cross-module:* by default.
Activity
dotnet-policy-service commentedon Sep 16, 2026
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Sep 16, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
richlander commentedon Sep 17, 2026
This is how I am installing the wasm SDK:
richlander/dotnet-inspect#7488
richlander commentedon Sep 23, 2026
I reduced this to one assembly and bounded the first bad daily.
Reproduction
The exact failing dotnet-inspect head is
469e912b6.Publishing its Inspect Web CoreCLR R2R variant with
12.0.100-alpha.1.26472.116leaves 96 of 97 expected R2R outputs. The onlymissing output is
DotnetInspect.Web.Core.dll.Replaying Crossgen2 directly for that linked assembly and the publish reference
closure reproduces the same exception:
crossgen2 --make-repro-pathproduced a standalone 14 MB repro bundle, andrunning its generated
repro.rspreproduces the exception independently ofMSBuild. The bundle SHA-256 is
eb5a78987847bf04a8a648e095cb00a3a46acba79a4598a4290fb5718621c30b.Boundary
The same generated repro gives:
12.0.0-alpha.1.26462.105c8c7ac15e5a07158cc2d5199d25d1840eaadf18e12.0.0-alpha.1.26463.1059da2930951f4498751b02ecf8546f6bde759ef9d12.0.0-alpha.1.26464.107b7e93309a78d453a032ddeb4c13ad57e5e6dffa812.0.0-alpha.1.26464.1202577879ab57d812ff130a476b34c717a1276adf312.0.0-alpha.1.26465.115b2f96bd7ac75c07fb8067c05c54767d3d5e12e8d12.0.0-alpha.1.26468.1061c1ae5d3edc93742cdcb2311db6d480723c1603312.0.0-alpha.1.26472.1160cfd699c3d0ad1d7054f237ccfbbb509b9d1c1e5The first bad VMR is dotnet/dotnet#9263. Its runtime codeflow is
3d267058...edd70ca5.InliningInfoNode.csitself is unchanged across the last-known-good and failingVMRs.
The repro requires the WebAssembly SDK's
--opt-cross-module:*argument:--opt-cross-module:*succeeds and emits the R2R Wasm file.--strip-inlining-infoalsosucceeds.
That narrows the failure to cross-module inlining-info construction or
serialization rather than general Wasm code generation. The first-bad runtime
range includes #133146, but I have not isolated the regression to
that PR.
I have the Crossgen2-generated bundle locally; GitHub's programmatic attachment
endpoint rejects ZIPs, so I can transfer it through another channel if useful.
lewing commentedon Sep 26, 2026
I reproduced this locally from the public
dotnet-inspectrepo at469e912b6with12.0.100-alpha.1.26472.116, so the repro bundle isn't needed. Thanks for narrowing it down to one assembly and the--opt-cross-module:*/--strip-inlining-infobehavior; that made it quick to pin down.The cause is in crossgen2's cross-module inlining info. When the runtime-async variant of a cross-module generic is compiled into the image and inlines another method (here, the async variant of
Task<Completion<...>>.WaitAsync(CancellationToken)inliningTimeProvider.get_System()), the compiler records theCheck_IL_Bodyfixup for the async variant. The inlining info writer then looked up the fixup for the plainEcmaMethodinstead. That import was never placed, so its index was unset and the checked cast overflowed.It comes from the async inlining change in #125472; #133146 probably just changed codegen enough to produce this case in your app. The bug isn't Wasm-specific, but browser CoreCLR R2R hits it first because it passes
--opt-cross-module:*by default.Fix and regression test: #134697
Note
This comment was generated with GitHub Copilot.
Fix crossgen2 OverflowException emitting inlining info for runtime-as…