Today we are going to discuss new features and improvements of ASP.NET Core 6.0. ASP.NET Core 6.0 is the latest version of ASP.NET Core and it’s released on 8-Nov 2021. Let’s discuss What’s new in ASP.NET Core 6.0 and its advantages.
What is ASP.NET Core?
ASP.NET Core is the rewritten version of ASP.NET and it’s a cross-platform and open-source framework to develop high-performance web applications. It was developed by Microsoft and can run on Windows, Linux, and Mac OS.
ASP.NET Core MVC and Razor improvments:
Minimal APIs:
Architected to create HTTP APIs with minimal dependencies. Minimal APIs are ideally used in microservices and apps where minimum features, files, and dependencies are required in ASP.NET Core.
SignalR:
Long-running activity tag of SignalR Connections. It is used by Application performance management (APM) services like Azure Monitor Application Insights to strain SignalR requests from creating long-running request alerts.
Signal Performance Improvement:
Instead of every method hub call, it allocates HubCallerClients.
Instead of per stream item in server-to-client streaming, It allocates a single StreamItemMessage per stream.
Razor Compiler:
In ASP.NET Core 6.0 Razor compiler is based on C# source generator and It really helps to speed up application build time by simplifying the razor compiler.
The previous razor compiler produces a separate View assembly. The updated razor compiler builds pages and views into the main project assembly.
ASP.NET Core Performance
- Reduced memory allocation when accessing the HttpRequest.Cookies
- Per connection, overhead is reduced in SocketConnection by ~30%.
- By removing logging delegates in generic types allocations are reduced
- 50% Faster GET access to commonly used features.
- Reuse HttpProtocol CancellationTokenSource in kestrel.
- Memory footprint is reduced for idle TLS connections.
- Size of
System.IO.Pipelines.Pipe
is reduced. - IAsyncDisposable is now supported and is available for controllers, pages, models, and views components.
- Hot Reload is now available. Now Razor pages and CSS files can be changed into a running project without rebuilding or restarting the project.
- Bootstrap 5.1 is supported by ASP.NET Core 6.0.
- In All ASP.NET Core 6.0 templates C# null-state analysis is by default enabled.
- Automatically added developer exception page middleware.
- Ahead-of-time (AOT) compilation is supported by Blazor web assembly where .NET code can be directly compiled into the web assembly.
- Support for Angular and React. Frontend Javascript other frameworks also can be used based on a flexible template pattern.
- HTTP headers can be accessed in a strongly typed way.
Blazor Improvements:
- Persisting state in a prerendered page is supported by Blazor so that when the app is fully loaded state doesn’t need to be recreated.
- Dynamically render Razor components from JavaScript for existing JavaScript Apps.
- For handling exceptions on the UI level error boundaries provide a convenient approach.
- Optimized byte array JS interop is supported that avoids encoding and decoding byte arrays into Base64.
- Support for Query strings is improved.
- Components are rendered from JavaScript.
- custom event arguments are supported which enable us to pass arbitrary data to .NET event hansdlers with custom events.
- JavaScript Initializers are supported.
If you have any queries or suggestions about this post do not hesitate to contact us or comment below.