Skip to content

Blazor WASM: "[MONO] * Assertion at ..., condition `<disabled>' not met" (AGAIN) #99030

Closed

Description

@PaulSorauer-IPG

Description

This looks like a gnarly one. 😳

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:

2024-02-28_16-01-07

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.

Known Workarounds

No response

Configuration

Using Blazor - tried in both Chrome and Edge.

Other information

No response

Activity

  1. ghost added
    untriaged
    on Feb 28, 2024
  2. added
    arch-wasm
    on Feb 28, 2024
  3. added this to the 8.0.x milestone on Mar 4, 2024
  4. ghost removed
    untriaged
    on Mar 4, 2024
  5. lewing commented on Mar 4, 2024

    @lewing
    Member

    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.

  6. PaulSorauer-IPG commented on Apr 28, 2024

    @PaulSorauer-IPG
    Author

    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.

  7. voroninp commented on Jul 10, 2024

    @voroninp

    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

    image

    voroninp.github.io-1720597518539.log

  8. joer33304 commented on Jul 12, 2024

    @joer33304

    Getting this too, I dont have <WasmStripILAfterAOT>true</WasmStripILAfterAOT> set

    image

  9. voroninp commented on Aug 14, 2024

    @voroninp

    Still the same error on latest preview .NET 9.0.0-preview.7.24405.7

  10. joer33304 commented on Sep 18, 2024

    @joer33304

    Error still present and still no resolution, I am coming to the conclusion that Blazor is useless.

  11. sofiageo commented on Sep 18, 2024

    @sofiageo
    Contributor

    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.

    dotnet watch ⌚ File added: ./Pages/Public/Index.razor~
    dotnet watch ⌚ File changed: ./Pages/Public/Index.razor
    dotnet watch 🔥 [Project.Blazor (net9.0)] Hot reload succeeded.
    
  12. joer33304 commented on Sep 18, 2024

    @joer33304

    In my case restarting the app always clears the error. However refreshing the whole app ion the browser does not clear the error

  13. Artilizansa commented on Oct 1, 2024

    @Artilizansa

    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.

  14. 1 remaining item

  15. mtsfoni commented on Oct 18, 2024

    @mtsfoni

    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.

  16. voroninp commented on Oct 18, 2024

    @voroninp

    @mtsfoni , these are my references:

    <ItemGroup>
      <PackageReference Include="BlazorBeforeUnload" Version="1.*" />
      <PackageReference Include="Blazored.LocalStorage" Version="4.*" />
      <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0-rc.2.24474.3" />
      <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0-rc.2.24474.3" PrivateAssets="all" />
      <PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.0-rc.2.24474.3" />
      <PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.*" />
      <PackageReference Include="System.Private.Uri" Version="4.3.2" />
      <PackageReference Include="System.Text.Json" Version="9.0.0-rc.2.24473.5" />
    </ItemGroup>
    

    I have issue with .NET 9 only when AOT is enabled. I had no problems with .NET 8

  17. voroninp commented on Nov 14, 2024

    @voroninp

    .NET 9 released. The error is still there.

    Here's the log of MONO
    voroninp.github.io-1731573811462.log

  18. voroninp commented on Nov 14, 2024

    @voroninp

    @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.

  19. vitek-karas commented on Nov 15, 2024

    @vitek-karas
    Member

    @voroninp

    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)

  20. vitek-karas commented on Nov 15, 2024

    @vitek-karas
    Member

    @BrzVlad could you please look at the interpreter issue here: #99030 (comment)

    dotnet.runtime.o8gq1i8bk6.js:3 [MONO] * Assertion at /__w/1/s/src/mono/mono/mini/interp/interp.c:2667, condition `<disabled>' not met
    

    Possibly create a separate issue for it (the original issue is about assert in the GC, so probably unrelated).

  21. voroninp commented on Nov 15, 2024

    @voroninp

    @vitek-karas , for console app it's indeed <PublishAot>true</PublishAot>, for Blazor it's <RunAOTCompilation>true</RunAOTCompilation>

    I'll create a separate issue.

  22. BrzVlad commented on Nov 17, 2024

    @BrzVlad
    Member

    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.

  23. actbit commented on Nov 17, 2024

    @actbit

    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.

    1. Change TargetFramework back to .net 8 from Visual Studio properties GUI and build. (You will get an error here, ignore it.)

    2. Change TargetFramework to net9.0 in .csproj

    3. Build and the problem will be solved.

    I hope this helps someone.

  24. sofiageo commented on Jan 23, 2025

    @sofiageo
    Contributor

    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 👍

  25. sascha-wegener commented on May 28, 2025

    @sascha-wegener

    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.

  26. SonOfKorriban commented on Jul 16, 2025

    @SonOfKorriban

    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

    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.6" PrivateAssets="all" />

  27. pavelsavara commented on Aug 1, 2025

    @pavelsavara
    Member

    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.

  28. locked and limited conversation to collaborators on Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-wasmarea-VM-meta-mono

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions