Reading Time: 9 minutes

On 25th June 2020, Microsoft shipped the sixth preview of .NET 5 saying they have achieved the milestone that was released to combine things. With this announcement, there will be one .Net going forward that will be used to target Windows, iOS, macOS, Linux, Android, watchOS, and WebAssembly.

.Net 5 Preview designed to combine everything and is today’s hot topic to discuss. You’ll find several Asp.net core development company considering .Net 5 Preview 6 features. Soon we’ll be expecting full-feature release with Preview 8. If you’re looking for .Net 5 Preview 6 download for windows, Linux and macOS, check below:

  • Windows and macOS installers
  • Binaries
  • Docker images
  • Snap installer

Let’s look for the .Net 5 Preview 6 features with its new release:

  • Blazor WebAssembly Template
  • Custom Handling of Authorization Failures
  • JSON Extension Methods
  • Allow Anonymous Access to Endpoint
  • SignalR Hub Filters

Using these features, Microsoft also announced that 50% of traffic gained from its .Net site in Preview 2 released. And .Net 5 is pretty functional that will fix bugs, polish existing features, and add new ones to get a higher scope for users. Preview 6 described as a small set of new features and performance improvements.

In today’s blog post, we’ll look into Preview 6 SDK features that support for Windows. Microsoft’s Program manager Richard Lander said: We can build and run windows forms apps on Windows ARM64 devices as we do on x64. The teams are currently working on adding support for WPF on Windows ARM64. The other change in .Net 5 Preview 6 is RyuJIT code quality improvement. It covers struct handling to remove redundant zero initializations. The platform’s support plans are updating, and soon user will be using them.

Check the sample below to understand how Windows Forms Apps runs on the ARM64 device.

Let’s get started with installing the .Net 5.0 SDK with ASP.NET Core in Preview 6. For .Net 5.0 you need to use Visual Studio 2019 16.7 and Visual Studio 2019 for Mac 8.6. Use the latest version of C# extension and use .Net 5.0 for Visual studio code.

Let’s dive in to understand what’s new in ASP.Net core updates

Blazor WebAssembly template

It includes .Net 5 SDK along with the Blazor Server template. With this, you can create a Blazor WebAssembly Project by running dotnet new blazorwasm. Blazor WebAssembly is a second supported way to host Blazor components like client-side in the browser that uses a WebAssembly-based .NET runtime. It comes with standardized bytecode for the web where the runtime downloaded with the Blazor WebAssembly app. You can hire ASP.Net MVC developer if you want to create a dotnet project with Blazor Web assembly.

JSON extension methods for HttpRequest and HttpResponse

With .Net 5.0 Preview 6, one can easily read and write JSON data. The HttpRequest and HttpResponse use ReadFromJsonAsonAsync and WriteAsJsonAsync extension methods. The methods use System.Text.Json serializer to handle JSON data. You can check for the JSON request content type using the HasJsonContentType extension method. The JSON extension methods can combine with endpoint routing with creating JSON APIs in style. You can get help from the ASP.Net Development company to work this out.

Let’s take an example that only has a handful of endpoints and use the route to code rather than having fully functional ASP.Net core MVC.

.NET Core Development Company

endpoints.MapGet(“/weather/{city:alpha}”, async context =>

{

    var city = (string)context.Request.RouteValues[“city”];

    var weather = GetFromDatabase(city);

    await context.Response.WriteAsJsonAsync(weather);

});

Source: https://devblogs.microsoft.com/

Extension method to allow endpoint access

In here, for anonymous access to the endpoint, you need to have a simpler AllowAnonymous extension along with using endpoint routing.

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

{

    app.UseRouting();

    app.UseAuthentication();

    app.UseAuthorization();

    app.UseEndpoints(endpoints =>

    {

        endpoints.MapGet(“/”, async context =>

        {

            await context.Response.WriteAsync(“Hello World!”);

        })

        .AllowAnonymous();

    });

}

Custom Handling of authorization failures

In this feature, we’ll be using the IAuthorizationMiddlewareResultHandler interface which invoked by Authorization Middleware. The default implementation will remain the same, and the custom handler will allow things based on why the authorization fails. Understand IAuthorizationMiddlewareResultHandler usage and its demonstration.

SignalR Hub filters

The Hub Filters are known as ASP.Net SignalR pipeline, which allows running code before and after Hub methods. It can work similarly to how middleware enables your code before and after using an HTTP request. It also includes common uses like logging, argument validation, and another error handling.

Closing

In the wake of this global pandemic, we’ve to adapt to the changing needs of our customers. We need to provide the support that assists with the smooth operations. We have given efforts to help customers address the most urgent needs. With time there are lot more expected features that will be available by November 2020 and will genuinely complete with .NET 6.

Additionally, Microsoft recommended that developers who build new applications with .Net Core 3.1 can migrate it to .Net 5. The company also defined that .Net framework application will support for long as windows will defend itself. If you’re still confused about how this will work out, hire ASP.Net MVC Development company or hire ASP.Net programmers for better results.