What the Blazor?

What the Blazor?!

C# code running in your browser?! What sorcery is this?!

In case you haven’t heard about it, Blazor is a Web Assembly and .NET-based framework which is a part of ASP.NET Core’s promise of running everywhere.

Blazor started out as a personal project of Steve Sanderson of Microsoft, first presented to the public in 2017. Blazor has now gone from a pet project to a soon to be stable released member of the Microsoft family.

Blazor has two major usages:

  • Clientside Blazor allows you to use C# for clientside programming
  • Serverside Blazor runs on the server via SignalR

Clientside Blazor allows you to write clientside code in C# like you would usually do with JavaScript, but you get all the benefits from C# and .NET. This includes static typing, unit test with the same tools you use for serverside C# programming, Intellisense/Intellicode and a nice debugging experience among other things.

Serverside Blazor uses SignalR to make updates to the GUI where needed, instead of refreshing the entire view. And this is done in real time. Blazor is designed for being able to run the application separate from the UI thread. This makes it possible for the application thread to push updates to the UI thread and not putting all the load on the UI thread.

Why should I use Blazor?

Pros:

  • All the strengths and features of the .NET platform
  • A very gentle learning curve for programmers familiar with C#
  • Blazor is supported by all mainstream browsers

Cons:

  • As of now performance leaves a great deal to be desired
  • Blazor is not production ready as of today

As of mid April 2019, Blazor went from an experimental project to an official preview. Serverside Blazor will ship as a part of .NET Core 3.0 (with a probable release during 2019). Clientside Blazor is confirmed for a stable release at a not yet decided date.

Personally I don’t believe that Blazor won’t be able to compete with JavaScript as a clientside technology, but it’s still an interesting concept. And it will give us JS challenged backend monkeys a quick and easy way to get into clientside programming in a language we’re more proficient in.

Curious about learning more? Check out this tutorial by Microsoft!

Author: Magnus Sundström