Repository navigation
Open
Labels
arch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration
Milestone
Description
Please backport #132306 (the fix for #130592) to release/10.0. #132522 took it to 11.0 only, so the bug still ships in the current .NET 10 runtime. #132306 is locked, so I am asking here.
We hit it in production in a Blazor WebAssembly app: after we turned on AOT, RuntimeError: memory access out of bounds crashes became about 30 times more frequent. The mapped frames read an invalid reference inside a loop (Enumerable.ToArray).
The loop from #132306's regression test reproduces it on every run on .NET 10, and does not on .NET 11:
| 10.0 (SDK 10.0.402, runtime pack 10.0.13) | 11.0 (SDK 11.0.100-rc.3.26522.148) | |
|---|---|---|
| AOT | 100/100 rounds lose a live reference | 0/100 |
| interpreter | 0/100 | 0/100 |
AOT + MONO_INTERPRETER_OPTIONS=-precise |
100/100 | |
AOT + MONO_GC_PARAMS=nursery-size=64m, minor GCs from allocation instead of GC.Collect |
100/100 |
So on .NET 10 we have no workaround except turning AOT off. Node 25, macOS arm64.
Repro (dotnet publish -c Release, copy main.mjs into bin/Release/net10.0/publish/wwwroot, node main.mjs)
Repro.csproj
<Project Sdk="Microsoft.NET.Sdk.WebAssembly">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<RunAOTCompilation>true</RunAOTCompilation>
</PropertyGroup>
</Project>Program.cs
using System.Runtime.CompilerServices;
public static class Program
{
private sealed class Box
{
public int Value;
public Box Self;
public Box(int v) { Value = v; Self = this; }
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static Box Make(int v) => new Box(v);
[MethodImpl(MethodImplOptions.NoInlining)]
private static void Touch(ref Box b) { if (b is null) throw new InvalidOperationException(); }
// The loop from GCTests.MovedAliasOfAddressTakenLocalIsRootedAcrossGC in #132306.
[MethodImpl(MethodImplOptions.NoInlining)]
private static bool Run()
{
Box[] witness = new Box[1];
Box cur = Make(0);
Touch(ref cur);
for (int i = 1; i <= 128; i++)
{
Box alias = cur;
witness[0] = cur;
cur = Make(i);
Touch(ref cur);
GC.Collect();
GC.KeepAlive(new byte[64]);
if (!ReferenceEquals(alias, witness[0]) || alias.Value != i - 1 || !ReferenceEquals(alias.Self, alias))
return false;
GC.KeepAlive(alias);
}
return true;
}
public static async Task<int> Main()
{
int failures = 0;
for (int round = 0; round < 100; round++)
{
await Task.Yield(); // a shallow stack, so no stale copy pins the object
if (!Run()) failures++;
}
Console.WriteLine($"{failures}/100 rounds lost a live reference");
return failures == 0 ? 0 : 1;
}
}main.mjs
import { dotnet } from './_framework/dotnet.js';
const { runMain, getConfig } = await dotnet.create();
process.exitCode = await runMain(getConfig().mainAssemblyName, []);Metadata
Metadata
Assignees
Labels
arch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration
Activity
dotnet-policy-service commentedon Oct 26, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JulieLeeMSFT commentedon Oct 27, 2026
@doverhill, .NET 11 will GA next month. Is it possible to upgrade to .NET 11?
doverhill commentedon Oct 28, 2026
@JulieLeeMSFT we have applied some mitigations to try to work around the issue in the hottest code paths while we are waiting for .NET 11. So I guess there are no plans for a .NET 10 backport?
JulieLeeMSFT commentedon Oct 28, 2026
We need a business justification to get .NET 10 servicing approval. Please let me know why you need .NET 10 or if you can wait for .NET 11.
dotnet-policy-service commentedon Nov 6, 2026
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.
JulieLeeMSFT commentedon Nov 6, 2026
@doverhill, pinging on this.
dotnet-policy-service commentedon Nov 6, 2026
This issue has been marked
needs-author-actionand may be missing some important information.doverhill commentedon Nov 7, 2026
We are preparing to move to .Net 11 instead after it has gone GA. Thank you.