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
Blazor WASM: "[MONO] * Assertion at ..., condition `<disabled>' not met" (AGAIN) #99030
I'm getting an "Error: [MONO] * Assertion at /__w/1/s/src/mono/mono/sgen/sgen-gc.c:2849, condition `' not met" exception raised in the browser in multiple places in my Blazor WASM app.
Anecdotally, this started around the point that I upgraded the .NET version from 8.0.0 to 8.0.2.
I've found a couple of similar threads, but they've long been resolved:
I was wondering if it was simply an 8.0.2 issue, but to my horror, if I downgrade my .NET version the error still occurs. "And why do you use the word, 'horror'?", I hear you ask? I'm glad you asked...
Even if I'm running .NET 8.00 or .NET 8.0.1, despite cleaning the repo via a git clean -fXd command, rebuilding the solution, clearing the entire browser cache or using different browsers, when I right-click the error in the browser it seems to indicate that it's coming from the 8.0.2 runtime:
I don't understand how I can no reference at all to .NET 8.0.2 with all the previous build artefacts nuked, but the app seems to still be running 8.02.
So long story short, I can't seem to get rid of the exception now it's started. Doesn't matter if I'm running .NET 8.00 or 8.0.1 or 8.0.2.
Can anyone assist me in troubleshooting this further, please? I've absolutely no idea where to go from here.
Cheers.
Reproduction Steps
I have no idea how to create something to preproduce this, considering I don't know where the problem lies and my entire solution is 150K lines of code (which I can't release).
Expected behavior
No Mono runtime exceptions
Actual behavior
Getting Mono runtime exceptions
Regression?
As above, I'm getting this across versions of .NET 8.0.0 - 8.0.2.
Your inability to get out of the broken state is likely because the workload manifests were updated to 8.0.2 and they do not get overwritten by new installs.
Error still present and still no resolution, I am coming to the conclusion that Blazor is useless.
Did you try to delete bin / obj directories before trying? Hot reload for simple changes started working again after updating to .NET 9 RC1. But I haven't tried it yet on a larger project.
Also got the same. Not exactly at the same .c file but the same exception. On my case, I have two repositories implementing an Interface. The first uses IndexeDB and the second, SQLite. The exception occurs only when the apps runs under SQLite. I can't understand the relationship. I have no idea where to start to diag ...
What is very strange is that ... I run the app under Debug on VS2022. I just add a breakpoint somewhere ... and I got the exception.
I don't know if other people are as stupid as I am:
But I got an error like this when changing target framework to 9 but leaving the Microsoft.AspNetCore.Components.WebAssembly and -.DevServer library on version 8. Changing those libraries to 9-rc2 fixed my problems (with aot+stripping as well as without).
Maybe it helps somebody who gets lost to this thread.
Reacted by Mike Casas, Matt, Naendo and Kevin Flynn
@vitek-karas , what has changed in .NET that AOT fails with regex having option NoBacktracking? As soon as I removed it, my app started to work.
Also, if I switch to source generation for regex, I get runtime error:
ManagedError: AggregateException_ctor_DefaultMessage (NoMetadataForType, System.Object, DutchVerbs.Spa.Infrastructure.SourceGenerationContext Path: $ | LineNumber: 0 | BytePositionInLine: 1.)
at sn (dotnet.runtime.o8gq1i8bk6.js:3:26894)
at Kt.resolve_or_reject (dotnet.runtime.o8gq1i8bk6.js:3:26449)
at dotnet.runtime.o8gq1i8bk6.js:3:172526
at dotnet.runtime.o8gq1i8bk6.js:3:172590
at fr (dotnet.runtime.o8gq1i8bk6.js:3:35046)
at Fc (dotnet.runtime.o8gq1i8bk6.js:3:172173)
at dotnet.native.sn79jhuo16.wasm:0x360233
at dotnet.native.sn79jhuo16.wasm:0x36c10f
at dotnet.native.sn79jhuo16.wasm:0x64a937
at dotnet.native.sn79jhuo16.wasm:0x91fccc
However, if I publish console application as AOT targeting Win x64, I cannot reprodcue the issue. It looks like it's Wasm/Mono's issue.
Can you please specify exactly how you turn on AOT?
For console apps we have PublishAOT=true which will end up using NativeAOT.
On WASM we don't use NativeAOT but the mono AOT.
My suspicion is that with AOT on in WASM we mess up IsDynamicCodeSupported somewhere and the regex engine goes down the path which would require interpreter and full metadata present.
Could you please try with .NET 9 GA? There was a fix for something similar late in 9 in regex.
(also - maybe create a separate issue for the regex problem as it seems unrelated to the original issue here)
The interpreter issue is caused by a missing wrapper in the aot image. It shouldn't really happen for these types of calls. I would need a repro to be able to tell exactly what is going on. An archive with the published app could definitely be useful if possible.
I had the same issue with "[MONO] * Assertion at ..., condition <disabled>' not met" when using [MethodImpl(MethodImplOptions.Synchronized)]`. Removing it fixed the issue for me.
I don't know if other people are as stupid as I am: But I got an error like this when changing target framework to 9 but leaving the Microsoft.AspNetCore.Components.WebAssembly and -.DevServer library on version 8. Changing those libraries to 9-rc2 fixed my problems (with aot+stripping as well as without).
Maybe it helps somebody who gets lost to this thread.
After setting the target framework to net9.0, i instantly got that error.
Changing Microsoft.AspNetCore.Components.WebAssembly.DevServer to Version="9.0.6" fixed it for me
There are many different problems mixed in the same GH issue here. I'm going to close this one.
Please create new issues with detailed steps to reproduce, if your problem still persists.
General hint: delete bin and obj folders after any .csproj changes, sdk upgrade or workload upgrade.
Activity
lewing commentedon Mar 4, 2024
Your inability to get out of the broken state is likely because the workload manifests were updated to 8.0.2 and they do not get overwritten by new installs.
PaulSorauer-IPG commentedon Apr 28, 2024
Actually we found the cause but I still think this is a strange symptom...
We were overriding an async init but had called the synchronous version of the base init by mistake.
We had a large commit so it was hard to find. How that error caused this is a whole different question.
Leaving this open for visibility in case there's a deeper issue.
voroninp commentedon Jul 10, 2024
I get this error both with .NET 8 and .NET 9 preview 6
when I enable IL stripping:
<WasmStripILAfterAOT>true</WasmStripILAfterAOT>Update: On .NET 9 it fails unconditionally.
voroninp/DutchVerbs@6282b54
voroninp.github.io-1720597518539.log
joer33304 commentedon Jul 12, 2024
Getting this too, I dont have
<WasmStripILAfterAOT>true</WasmStripILAfterAOT>setvoroninp commentedon Aug 14, 2024
Still the same error on latest preview .NET 9.0.0-preview.7.24405.7
joer33304 commentedon Sep 18, 2024
Error still present and still no resolution, I am coming to the conclusion that Blazor is useless.
sofiageo commentedon Sep 18, 2024
Did you try to delete bin / obj directories before trying? Hot reload for simple changes started working again after updating to .NET 9 RC1. But I haven't tried it yet on a larger project.
joer33304 commentedon Sep 18, 2024
In my case restarting the app always clears the error. However refreshing the whole app ion the browser does not clear the error
Artilizansa commentedon Oct 1, 2024
Also got the same. Not exactly at the same .c file but the same exception. On my case, I have two repositories implementing an Interface. The first uses IndexeDB and the second, SQLite. The exception occurs only when the apps runs under SQLite. I can't understand the relationship. I have no idea where to start to diag ...
What is very strange is that ... I run the app under Debug on VS2022. I just add a breakpoint somewhere ... and I got the exception.
1 remaining item
mtsfoni commentedon Oct 18, 2024
I don't know if other people are as stupid as I am:
But I got an error like this when changing target framework to 9 but leaving the
Microsoft.AspNetCore.Components.WebAssemblyand -.DevServerlibrary on version 8. Changing those libraries to 9-rc2 fixed my problems (with aot+stripping as well as without).Maybe it helps somebody who gets lost to this thread.
voroninp commentedon Oct 18, 2024
@mtsfoni , these are my references:
I have issue with .NET 9 only when AOT is enabled. I had no problems with .NET 8
voroninp commentedon Nov 14, 2024
.NET 9 released. The error is still there.
Here's the log of MONO
voroninp.github.io-1731573811462.log
voroninp commentedon Nov 14, 2024
@vitek-karas , what has changed in .NET that AOT fails with regex having option
NoBacktracking? As soon as I removed it, my app started to work.Also, if I switch to source generation for regex, I get runtime error:
However, if I publish console application as AOT targeting Win x64, I cannot reprodcue the issue. It looks like it's Wasm/Mono's issue.
vitek-karas commentedon Nov 15, 2024
@voroninp
Can you please specify exactly how you turn on AOT?
For console apps we have
PublishAOT=truewhich will end up using NativeAOT.On WASM we don't use NativeAOT but the mono AOT.
My suspicion is that with AOT on in WASM we mess up
IsDynamicCodeSupportedsomewhere and the regex engine goes down the path which would require interpreter and full metadata present.Could you please try with .NET 9 GA? There was a fix for something similar late in 9 in regex.
(also - maybe create a separate issue for the regex problem as it seems unrelated to the original issue here)
vitek-karas commentedon Nov 15, 2024
@BrzVlad could you please look at the interpreter issue here: #99030 (comment)
Possibly create a separate issue for it (the original issue is about assert in the GC, so probably unrelated).
voroninp commentedon Nov 15, 2024
@vitek-karas , for console app it's indeed
<PublishAot>true</PublishAot>, for Blazor it's<RunAOTCompilation>true</RunAOTCompilation>I'll create a separate issue.
BrzVlad commentedon Nov 17, 2024
The interpreter issue is caused by a missing wrapper in the aot image. It shouldn't really happen for these types of calls. I would need a repro to be able to tell exactly what is going on. An archive with the published app could definitely be useful if possible.
actbit commentedon Nov 17, 2024
I had the same problem when I updated from .net 8 to .net 9, but the following steps solved it for me.
I don't know why it solved it.
Change TargetFramework back to .net 8 from Visual Studio properties GUI and build. (You will get an error here, ignore it.)
Change TargetFramework to net9.0 in .csproj
Build and the problem will be solved.
I hope this helps someone.
sofiageo commentedon Jan 23, 2025
I just tried the 9.0.2XX dotnet sdk daily build and it seems hot reload finally works properly. I hope it will stay like this from now on 👍
sascha-wegener commentedon May 28, 2025
I had the same issue with "[MONO] * Assertion at ..., condition
<disabled>' not met" when using[MethodImpl(MethodImplOptions.Synchronized)]`. Removing it fixed the issue for me.SonOfKorriban commentedon Jul 16, 2025
After setting the target framework to net9.0, i instantly got that error.
Changing Microsoft.AspNetCore.Components.WebAssembly.DevServer to Version="9.0.6" fixed it for me
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.6" PrivateAssets="all" />pavelsavara commentedon Aug 1, 2025
There are many different problems mixed in the same GH issue here. I'm going to close this one.
Please create new issues with detailed steps to reproduce, if your problem still persists.
General hint: delete
binandobjfolders after any .csproj changes, sdk upgrade or workload upgrade.