Believe it or not the first mode to surface as a thing from Microsoft was actually a first version of what we now refer to as ‘Blazor WebAssembly’

Blazor WebAssembly Hosting Mode




We will need to go back in time 8 years to see how the ideas for this came about:


Chris dunemlm worked on a version of .Net that would be super compact runtime that could run on a larger set of devices called:DotNetAnywhere

LINK

https://github.com/chrisdunelm/DotNetAnywhere


If we then jump forward 6 years we get to 2018 and Steve Sanderson picks up dotnetanywhere/mono development with the goal of running it in WebAssembly, as in running .net in the browser


Fantastic start but to go from outputting strings and plaintext from C# is one thing but to interact and create a programming pipeline with DOM updates supporting web standards was still quite a way off.


TELEPROMPTER

So after some amazing work, WebAssembly is in preview and scheduled for production next month.

So What exactly is it?

WebAssembly Breakdown

WebAssembly is more of a target -

WebAssembly is Low level byte code, and you can compile to it


What this means and why it is so exciting is literally for the first time in web development history it breaks the mold of Javascript having complete control over client side/frontend application development.

There are multiple languages targeting WebAssembly:

C# AKA Blazor

Rust - C#, C++


How does that actually work

We write our code in C# and that just gets compiled to dlls

Then, in the browser, Blazor runs on top of the Mono .Net runtime and that is where it gets compiled to WebAssembly

So Mono is compiled to WebAssembly

That loads C# dlls and executes C# code in the browser

Cool

Caveats

WebAssembly is a very new standard and there is still a lot of changes and features still to be added


Also still need to use Javascript to interact with a lot of Javascript APIS

Geo location, local storage


What is interesting is you can wrap those JS libraries as NuGet packages and focus purely on C# as all the hard work, the interop, has been done for you. You can just deal with C# APIS and NuGet packages and then you don’t actually need to write any javascript