Skip to content

WASM AOT fails with regex in .NET 9 #109862

@voroninp

Description

@voroninp

Description

I am playing with Blazor and discovered that for some reason publishing application as WASM AOT breaks it one way or another.

Here is the repo

If I use regular (not source generated regex with NonBacktracing option, application fails at startup.

Here is an example of the log I see in browser console. (including debug logs from Mono):
voroninp.github.io-1731573811462.log

If I remove NonBacktracking application start without any issue.

When I switch to source generated regex, I have another 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

P.S. I was asked to create a new issue by @vitek-karas here

Reproduction Steps

Visit this url to see the error, or play with the repository https://github.com/voroninp/DutchVerbs

Expected behavior

It should not fail.

Actual behavior

It fails.

Regression?

I did not have the problem with .NET 8

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions