I’m building an Android application that needs to execute C# code from DLLs via WebAssembly. With .NET 9, everything works fine using this approach:
- Blazor WebAssembly project
- C# methods decorated with
[JSInvokable] - Build the project → get the
/frameworkfolder - Copy
/frameworkinto the Angular app - Call C# from JavaScript using:
DotNet.invokeMethodAsync("MyAssembly", "MyMethod")
After upgrading the C# projects to .NET 10, the whole setup breaks.
It looks like Blazor WebAssembly / JS interop internals have changed significantly and I can no longer call C# methods from my Angular app.
What I tried
[JSInvokable](Blazor-style interop) no longer works;DotNet.invokeMethodAsyncfails. The runtime initialization seems different / missing.[JSExport](Native WASM interop). I tried the “new” recommended approach:dotnet publish -c Release -r browser-wasm. This produces.wasmand.jsfiles;[JSExport]methods are compiled correctly, but when calling it from Angular, I get:createDotNetRuntime is not defined
How can I call or load the .NET WASM runtime in a .NET 10 app? Or is there a replacement for DotNet.invokeMethodAsync?
Downgrading back to .NET 9 is not a viable long-term solution.