BT

Your opinion matters! Please fill in the InfoQ Survey!

Blazor Brings .NET Back to the Browser

| by Jonathan Allen Follow 199 Followers on Jul 14, 2017. Estimated reading time: 1 minute |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

Steve Sanderson’s Blazor is an experiment to bring .NET back to the browser using WebAssembly. It isn’t meant to be a full production framework like Flash or Silverlight, but rather a test to see what’s possible.

WebAssembly describes itself as a standard for “a memory-safe, sandboxed execution environment that may even be implemented inside existing JavaScript virtual machines.” While it will perform better in browsers that natively support it, WebAssembly can be interpreted by older browsers using a converter and asm.js.

Currently WebAssembly is designed primarily to support C and C++ applications. It acts as a compiler backend for clang/LLVM. To get from C to C#, Blazor used another research project. Chris Bacon’s DotNetAnywhere was a C-based interpreter for .NET’s Common Intermediate Language (a.k.a. IL, CIL, MSIL). The DotNetAnywhere project ended about six years ago.

Blazor makes the following changes to DotNetAnywhere:

  • To support building with Emscripten
  • To support p/invoke calls from .NET to JavaScript
  • To add other interop primitives, e.g., GCHandle
  • To receive inbound calls from JavaScript to .NET
  • To fix some bugs
  • To support loading .NET Core-style assemblies

Blazor applications are built using Razor templates that are executed in the browser rather than on the server. According to the documentation, a simple “hello world” application requires 300KB download. This includes “everything: the small .NET runtime, core libraries, application code, and wrapper libraries needed to bootstrap and interop with the WebAssembly code”.

No effort has been made to strip out code that isn’t actually called, so it's possible to reduce this size even further.

To see this in action, watch the NDC Conference video titled Web Apps can’t really do *that*, can they? - Steve Sanderson.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Great! by Néstor Marcel Sánchez A.

Hopefully, more soon than late, we could use C# also in the web pages.

Just fantastic! by Stephen Brown

This is amazing. Please Microsoft, investigate and develop this technology into a real world platform.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT