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
[wasm] mono-aot-cross asserts with function:mono_method_to_ir, VAR 1 (TValue_REF) cannot be expanded in this context with 1 instantiations #57560
Migrated a Blazor application from .NET 5 to latest 6 preview and wanted to test AOT which led me to this error.
Managed to narrow it down to a dictionary implementation which had a strange equality operator overload using EqualityComparer<>.Default.Equals(left, right);. Changing it to just Equals(left, right); fixed it (IEquatable<> is implemented). I have a full repro in the zip-file below.
> dotnet publish -c Release
Microsoft (R) Build Engine version 17.0.0-preview-21378-03+d592862ed for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
SomeTestLib -> C:\code\private\wasmtest\SomeTestLib\bin\Release\net6.0\SomeTestLib.dll
wasmtest -> C:\code\private\wasmtest\wasmtest\bin\Release\net6.0\wasmtest.dll
wasmtest (Blazor output) -> C:\code\private\wasmtest\wasmtest\bin\Release\net6.0\wwwroot
Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
AOT'ing 30 assembliesC:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\6.0.0-preview.7.21377.19\Sdk\WasmApp.Native.targets(443,5): error : Precompiling failed for C:\code\private\wasmtest\wasmtest\obj\Release\net6.0\linked\SomeTestLib.dll: Mono Ahead of Time compiler - compiling assembly C:\code\private\wasmtest\wasmtest\obj\Release\net6.0\linked\SomeTestLib.dll [C:\code\private\wasmtest\wasmtest\wasmtest.csproj]C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\6.0.0-preview.7.21377.19\Sdk\WasmApp.Native.targets(443,5): error : * Assertion at D:\workspace\_work\1\s\src\mono\mono\mini\method-to-ir.c:7318, condition `is_ok (error)' not met, function:mono_method_to_ir,VAR1 (TValue_REF) cannot be expanded in this context with 1 instantiations [C:\code\private\wasmtest\wasmtest\wasmtest.csproj]
PS > dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.7.21379.14
Commit: 22d70b47bc
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\
Host (useful for support):
Version: 6.0.0-preview.7.21377.19
Commit: 91ba01788d
And add ValueDictionary<string, string> vd = new(); to Program.cs
src/mono/sample/wasm/console$ make all V=1 AOT=1
Mono Ahead of Time compiler - compiling assembly /Users/radical/dev/r2/src/mono/sample/wasm/console/bin/browser-wasm/publish/Wasm.Console.Sample.dll
* Assertion at /Users/radical/dev/r2/src/mono/mono/mini/method-to-ir.c:7319, condition `is_ok (error)' not met, function:mono_method_to_ir, VAR 1 (TValue_REF) cannot be expanded in this context with 1 instantiations
changed the title [-]Blazor AOT build failure due to EqualityComparer usage[/-][+][wasm] `mono-aot-cross` asserts with `function:mono_method_to_ir, VAR 1 (TValue_REF) cannot be expanded in this context with 1 instantiations `[/+]on Aug 23, 2021
Activity
radical commentedon Aug 23, 2021
This can be reproduced with the wasm/console sample in
src/mono/sample/wasm/console:ValueDictionary.cswith:ValueDictionary<string, string> vd = new();toProgram.cssrc/mono/sample/wasm/console$ make all V=1 AOT=1cc @vargaz @BrzVlad
[-]Blazor AOT build failure due to EqualityComparer usage[/-][+][wasm] `mono-aot-cross` asserts with `function:mono_method_to_ir, VAR 1 (TValue_REF) cannot be expanded in this context with 1 instantiations `[/+]lewing commentedon Aug 24, 2021
cc @SamMonoRT
vargaz commentedon Aug 24, 2021
If this is release critical, the assert can simple by removed, i.e. change it to:
Since this is just an optimization, disabling it in this case is not going to matter much.
[mono] Avoid a JIT assert.
[mono] Avoid a JIT assert. (#58071)
[mono] Avoid a JIT assert.
[mono] Avoid a JIT assert. (#58127)
vargaz commentedon Oct 1, 2021
This was not actually fixed, the testcase still fails. My bad.
SamMonoRT commentedon Oct 1, 2021
@vargaz @marek-safar - should the right fix be backported to rc2 ?
vargaz commentedon Oct 1, 2021
I think so. Its low-risk.
lewing commentedon Oct 1, 2021
too late for rc2, we can still target 6.0 if required
[mono][jit] Fix a JIT assert.
marek-safar commentedon Oct 1, 2021
This is low risk with already 2 reports from customers, let's get this in.
@lewing could you send tactics email?
[mono][jit] Fix a JIT assert.
[mono][jit] Fix a JIT assert. (#59869)
[mono][jit] Fix a JIT assert. (#59861)