Fordy
Fordy

Reputation: 780

In a Blazor WebAssembly app when do the .Net Framework DLLs downloaded in the browser get converted to webassembly?

In my Blazor WebAssembly application I can see myapp.dll and the .Net Framework DLLs downloaded in the browser, but as the browser can only execute the webassembly language (.wasm), are these dll files converted or compiled to the webassembly language as required at runtime?

Upvotes: 1

Views: 993

Answers (2)

Henk Holterman
Henk Holterman

Reputation: 273294

The .net binaries contain IL code that currently is interpreted by the RunTime. Only the RunTime itself is compiled to Wasm.

Interpretation is not the fastest option, a lot of effort has gone into speeding it up in the Net5 release.

Blazor is fast enough for normal UI tasks. But for example deserializing (very) large JSON messages is clearly slower than in normal .net.

A future runtime could add a compiler (JIT or AOT). We will have to wait.

Upvotes: 2

enet
enet

Reputation: 45646

The .Net Framework DLLs downloaded in the browser are never get converted to webassembly. Only the Mono runtime is compiled to WebAssembly, and your .Net dlls are executed as is under Mono.

One thing that sticks out in this implementation is that rather than compiling every bit of .NET code that your application runs to WASM, only the Mono Runtime is compiled as a WASM module. All of the Blazor framework and your application code is loaded as plain old .NET assemblies that are executed through Mono.

Read more:

Upvotes: 2

Related Questions