News

What's New for ASP.NET Core and Blazor in Final Preview of .NET Core 3.0

Improved gRPC functionality is just one many new improvements in the ASP.NET Core component of .NET Core 3.0 Preview 9, the last step before the entire .NET Core 3.0 platform hits general availability in about three weeks.

Many Microsoft-centric developers were up in arms about the company's decision to abandon Windows Communication Foundation (WCF) -- part of the traditional .NET Framework -- in the move to.NET Core in favor of other mechanisms such as gRPC (Google's open source take on remote procedure call systems).

Microsoft earlier this year said, "If you are a remoting or WCF developer and want to build a new application on .NET Core, we would recommend either ASP.NET Core Web APIs or gRPC (Google RPC, which provides cross platform and cross programming language contract based RPCs)."

To that end, the final .NET Core 3.0 preview boosts gRPC functionality in the ASP.NET Core component. Preview 9 sports a new client API for gRPC and features support for async streams in streaming gRPC responses.

"To improve compatibility with the existing Grpc.Core implementation, we've changed our client API to use gRPC channels," said Daniel Roth, principal program manager for ASP.NET, in a Sept. 4 blog post. "The channel is where gRPC configuration is set and it is used to create strongly typed clients. The new API provides a more consistent client experience with Grpc.Core, making it easier to switch between using the two libraries."

Furthermore, Roth said, "gRPC streaming responses return a custom IAsyncStreamReader type that can be iterated on to receive all response messages in a streaming response. With the addition of async streams in C# 8, we've added a new extension method that makes for a more ergonomic API while consuming streaming responses."

Blazor, the red-hot project recently graduated from experimental stage that lets developers use C# in Web projects instead of (or in addition to) JavaScript, thanks to WebAssembly, received several routing improvements in this preview, including the abilities to:

  • Render content using a specific layout
  • Routing decoupled from authorization
  • Route to components from multiple assemblies

Other improvements in Preview 9 listed by Roth include:

  • Blazor event handlers and data binding attributes moved to Microsoft.AspNetCore.Components.Web: "In this release we moved the set of bindings and event handlers available for HTML elements into the Microsoft.AspNetCore.Components.Web.dll assembly and into the Microsoft.AspNetCore.Components.Web namespace."
  • Render multiple Blazor components from MVC views or pages: "We've reenabled support for rendering multiple components from a view or page in a Blazor Server app. To render a component from a .cshtml file, use the Html.RenderComponentAsync(RenderMode renderMode, object parameters) HTML helper method with the desired RenderMode."
  • Smarter reconnection for Blazor Server apps: "Blazor Server apps are stateful and require an active connection to the server in order to function. If the network connection is lost, the app will try to reconnect to the server. If the connection can be reestablished but the server state is lost, then reconnection will fail. Blazor Server apps will now detect this condition and recommend the user to refresh the browser instead of retrying to connect."
  • Utility base component classes for managing a dependency injection scope: "In ASP.NET Core apps, scoped services are typically scoped to the current request. After the request completes, any scoped or transient services are disposed by the dependency injection (DI) system. In Blazor Server apps, the request scope lasts for the duration of the client connection, which can result in transient and scoped services living much longer than expected."
  • Razor component unit test framework prototype: "We've started experimenting with building a unit test framework for Razor components. You can read about the prototype in Steve Sanderson's Unit testing Blazor components – a prototype blog post."
  • Helper methods for returning Problem Details from controllers: "Problem Details is a standardized format for returning error information from an HTTP endpoint. We've added new Problem and ValidationProblem method overloads to controllers that use optional parameters to simplify returning Problem Detail responses."

All of the above and more is detailed in the blog post and the release notes.

The official general availability release of .NET Core 3.0 is scheduled for the online virtual event, .NET Conf, to be held Sept 23-25.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • Visual Studio Code Dev Team Cleans Up

    The Visual Studio Code development team focused on some housekeeping in the October update, closing more than 4,000 issues on GitHub, where the cross-platform, open-source editor lives.

  • ML.NET Model Builder Update Boosts Image Classification

    Microsoft announced an update to the Model Builder component of its ML.NET machine learning framework, boosting image classification and adding "try your model" functionality for predictions with sample input.

  • How to Do Naive Bayes with Numeric Data Using C#

    Dr. James McCaffrey of Microsoft Research uses a full code sample and screenshots to demonstrate how to create a naive Bayes classification system when the predictor values are numeric, using the C# language without any special code libraries.

  • Vortex

    Open Source 'Infrastructure-as-Code' SDK Adds .NET Core Support for Working with Azure

    Pulumi, known for its "Infrastructure-as-Code" cloud development tooling, has added support for .NET Core, letting .NET-centric developers use C#, F# and VB.NET to create, deploy, and manage Azure infrastructure.

  • .NET Framework Not Forgotten: Repair Tool Updated

    Even though Microsoft's development focus has shifted to the open-source, cross-platform .NET Core initiative -- with the aging, traditional, Windows-only .NET Framework relegated primarily to fixes and maintenance such as quality and reliability improvements -- the latter is still getting some other attention, as exemplified in a repair tool update.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events