News

Microsoft Updates Blazor Project for .NET Web Apps Using WebAssembly

Blazor, the experimental project underway at Microsoft to provide Web app development with .NET tools such as C#, has just been updated with new features as it journeys to beta status.

The new Blazor 0.3.0 release -- still in alpha stage -- comes just barely a couple weeks after 0.2.0 was announced last month, providing bug fixes and new features as Microsoft drives the much-ballyhooed project forward.

Meanwhile, Microsoft dev execs such as Scott Hunter are making the rounds to publicize the benefits of Blazor, which stole the show at a recent Hunter keynote address at the Visual Studio Live! conference in Austin. Expect more to come at Microsoft's Build conference next week.

To provide full-stack, client/server .NET Web apps without all that pesky and slow JavaScript, Blazor leverages the new WebAssembly project that converts higher-level language code to assembly-like code for native-speed performance. WebAssembly also works with programming languages such as C, C++ and Rust.

Blazor, meanwhile, is focused on putting WebAssembly to work with C#. The new updates announced Wednesday (May 2) include new project templates using Bootstrap4.

Bootstrap is an open source toolkit for creating HTML, CSS and JavaScript projects, letting developers quickly prototype ideas or build entire apps with its Sass variables and mixins, responsive grid system, extensive readymade components, and jQuery-based plug-ins, it's site says.

Microsoft' Daniel Roth said that in addition to providing a new fresh look to Blazor templates with new styles, "Bootstrap 4 includes lots of new features including an improved grid system based on flexbox, an improved reset file, new components, better tooltip support, better forms styling, built-in spacing utilities, and much more."

With support for async event handlers, meanwhile, "Event handlers can now be asynchronous and return a Task that gets managed by the runtime. Once the task is completed the component is rendered without the need to manually invoke StateHasChanged. Any exceptions that occur during the asynchronous execution of the event handler will be correctly handled and reported."

Roth also highlighted more strongly typed events for most common browser events, helping components handle user actions like mouse clicks, keypresses and even focus events.

He noted there's still work to be done on event handling, hopefully with the help of volunteers. "Most of the event arguments don't yet capture and surface the data from the events. That's something that we expect to handle in a future release. We welcome community contributions to help out with this effort."

Other new features include:

  • New component lifecycle events: OnAfterRender/OnAfterRenderAsync
  • Component and element refs
  • Better encapsulation of component parameters
  • Simplified layouts

In response to a reader question, Roth also revealed the team has no plans to target mobile development with Blazor -- just Web -- at this time, though he didn't rule out a change in that view in the future. For now, it's Xamarin for .NET-based mobile development.

Developers putting Blazor through its paces in this early experimental stage -- it requires the latest preview bits for .NET Core, Visual Studio, and so on, so the process might be a bit rough around the edges -- can file issues on GitHub and communicate on Gitter.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

Subscribe on YouTube