Blazor WASM's Deputy Thread Model Will Break JavaScript Interop - Here's Why That Matters
The Problem Microsoft is changing how .NET runs inside WebAssembly. When you enable threading with <WasmEnableThreads>true</WasmEnableThreads>, the entire .NET runtime moves off the bro...

Source: DEV Community
The Problem Microsoft is changing how .NET runs inside WebAssembly. When you enable threading with <WasmEnableThreads>true</WasmEnableThreads>, the entire .NET runtime moves off the browser's main thread and onto a background Web Worker — what they call the "Deputy Thread" model. This sounds like a good idea on paper. The UI stays responsive. .NET gets real threads. Everyone wins. Except it breaks JavaScript interop. Not in a subtle, edge-case way. It breaks it fundamentally. What Actually Happens In traditional Blazor WASM (no threading), .NET and JavaScript share the same thread. When JavaScript calls DotNet.invokeMethod, the CPU jumps from the JS stack to the C# stack and back. It's fast. It's synchronous. It works. In the Deputy Thread model, .NET lives in a Web Worker. JavaScript lives on the UI thread. They're in different worlds. When JavaScript tries to call DotNet.invokeMethod, the UI thread would have to block while waiting for the worker to respond. Browsers don'