Special Offer: My C#/.NET Bootcamp Course is out now. Get 10% OFF using the code FRIENDS10.

Are you interested in .NET 8? I know I am. In this video, I will show you how .NET 8 will make your ASP.NET Core development faster, easier, and more fun.

Hint: The video and the article were created in February 2023 when the .NET 8 Preview 1 and Preview 2 were released.

In a previous video, I covered the general features of the upcoming .NET 8 platform; check it out if you haven’t already. 

Today, we’ll focus entirely on what we know about ASP.NET Core from .NET 8 Preview 1 and Preview 2.

Blazor United

Blazor United definitely is the hottest feature expected with .NET 8. Currently, we have MVC, Razor Pages, and Blazor. All of them have their strengths and weaknesses. 

Sometimes, you would benefit from combining server-side and client-side rendering in a single web application. That’s where Blazor United will make a huge difference in the future.

The idea behind Blazor United is to have a single project that allows you to decide for every page if it is a server-side or client-side rendered page. 

Blazor United should allow us to render some components using Blazor Server and others using Blazor WebAssembly to get the best of both approaches. 

We will also be able to generate content server-side using the same Blazor component model, which will help create pages that search engines should index.

Learn more in Steve Sanderson’s Blazor United Prototype video. Check it out if you want to learn more about Blazor United.

Blazor QuickGrid Component

The Blazor QuickGrid component was added with .NET 8 Preview 2. It is a component optimized for performance and displays data as a table. It includes support for sorting, filtering, paging, and virtualization.

@page "/quickgrid-example"
@using Microsoft.AspNetCore.Components.QuickGrid

<QuickGrid Items="@people">
    <PropertyColumn Property="@(p => p.PersonId)" Sortable="true" />
    <PropertyColumn Property="@(p => p.Name)" Sortable="true" />
    <PropertyColumn Property="@(p => p.PromotionDate)" Format="yyyy-MM-dd" Sortable="true" />
</QuickGrid>

@code {
    private record Person(int PersonId, string Name, DateOnly PromotionDate);

    private IQueryable<Person> people = new[]
    {
        new Person(10895, "Jean Martin", new DateOnly(1985, 3, 16)),
        new Person(10944, "António Langa", new DateOnly(1991, 12, 1)),
        new Person(11203, "Julie Smith", new DateOnly(1958, 10, 10)),
        new Person(11205, "Nur Sari", new DateOnly(1922, 4, 27)),
        new Person(11898, "Jose Hernandez", new DateOnly(2011, 5, 3)),
        new Person(12130, "Kenji Sato", new DateOnly(2004, 1, 9)),
    }.AsQueryable();
}

Source: learn.microsoft.com

The QuickGrid component comes with a PropertyColumn component that allows us to select the property of the object that we want to assign to the table column. There are convenient properties to enable sorting and formatting data.

For more advanced columns, there is the TemplateColumn component that allows us to use custom HTML as the column template. There is an entire demo page with samples of how to use the QuickGrid component.

My personal opinion is that components like this help us build applications that do not require a third-party UI controls library. For example, internal applications or tools. If we work on a project that already has a third-party UI controls library, we would probably also use their grid component.

Improved Blazor WebAssembly Performance

It’s a complex process of how a Blazor WebAssembly application ships to a browser and how the code is executed. With .NET 8, there is a new runtime feature called Jiterpreter, which I obviously don’t know how to pronounce.

The broad idea is to improve the runtime performance by enabling partial JIT support when running Blazor WebAssembly.

If you want to learn more about the technical details, I highly suggest reading the ASP.NET Core Update Preview 2 blog post. For me, the key takeaway is that some of the low-level operations will have a performance boost of up to 50%, which sounds like a lot to me.

Improved authentication & authorization experience

Authentication and authorization is always a difficult topic for me. I’m very happy that with .NET 8, Microsoft wants to provide us with an easier and more intuitive solution.

Besides new APIs, better tooling support for deployment to production environments and diagnostics to help troubleshoot security issues are the focus of .NET 8.

It’s unclear what exactly they intend to do here, but I’m happy that authentication and authorization are on their list for .NET 8 improvements.

Other Improvements

A few little things that will come with .NET 8 and stand out for me are:

  • Blazor WebAssembly debugging support for Firefox. However, be aware that debugging from Visual Studio won’t work. You have to configure the browser for remote debugging and connect to the browser using the browser developer tools using the .NET WebAssembly proxy. There is a detailed step-by-step explanation in the blog post linked in the video description.
  • HTTP/3 enabled by default. HTTP/3 promises faster connection setup besides other improvements. With .NET 7, using HTTP/3 was opt-in. Starting with .NET 8, HTTP/3 will be enabled by default for new projects.
  • Hot reload support for class instance fields, properties, and events for .NET on WebAssembly.

ASP.NET Core Roadmap for .NET 8

At the time of recording the video and writing this article, there were 36 items split across the categories servers/protocols, minimal APIs, MVC, and Blazor on the ASP.NET Core Roadmap for .NET 8

From the number of items on the roadmap, we can see that Blazor is the focus of .NET 8 in the ASP.NET Core area.

Conclusion

A lot is going on, and we’re only at Preview 2. There are about seven to eight months until the final release of .NET 8. However, we can already see a few very interesting additions and improvements.

For me, Blazor United is the shiny new feature, and I’m really looking forward to getting my hands dirty and exploring how it works. Right now, it feels like it will lift Blazor to another level.

What feature are you looking for the most? If you could add to the list, what feature would you like to have in .NET 8? Let me know in the comments.

If you made it that far, consider subscribing to my YouTube channel so you won’t miss out on future content about .NET development.

 

Claudio Bernasconi

I'm an enthusiastic Software Engineer with a passion for teaching .NET development on YouTube, writing articles about my journey on my blog, and making people smile.