The best VPN 2024

The Best VPS 2024

The Best C# Book

.NET 6 Preview 3 released

Spread the love

.NET 6 Preview 3 released, 2021/4/8 .NET 6 Preview 3 is released. Most of the improvements in this version come from the bottom layer. Let’s take a look at the new features and improvements.

Library improvements

.NET 6 Preview 3 released
.NET 6 Preview 3 released

A faster processing method when new value-added types are used as dictionary values

.NET 6 Preview 3 introduces a new unsafe API CollectionsMarshal.GetValueRef, this API allows you to update the value in place without data copy, and reduce the hash calculation of the key from 2 times to 1 time. Dictionary stored in the scene updates to improve high performance at structvery useful.

E.g:

ref MyStruct value = CollectionsMarshal.GetValueRef(dictionary, key);
// If it does not exist, return Unsafe.NullRef<TValue>()
if (!Unsafe.IsNullRef(ref value))
{
     // No need to copy
     value.MyInt++;
}

Interface check and conversion performance improvement

The performance of interface conversion and checking whether the type implements an interface has been improved by 16~38%. This improvement is especially useful for improving the performance of pattern matching.

.NET 6 Preview 3 released
.NET 6 Preview 3 released

Runtime

.NET 6 Preview 3 also includes more runtime improvements

Code generation optimization

Dynamic PGO

Keep the value type structure in the register

Complete. NET 6 exception handler write-through

.NET 6 Preview 3 released
.NET 6 Preview 3 released

.NET hot reload is initially available for web applications

.NET 6 Preview 3 enabled initial support for ASP.NET Core and Blazor thermal overload, only need dotnet watchto use to start the project, but need to be modified Properties/launchSettings.jsonbefore you can use thermal overload:

For ASP.NET Core applications, add "hotReloadProfile": "aspnetcore"; for Blazor WebAssembly applications, add "hotReloadProfile": "blazorwasm".

Hot reloading can directly apply code updates without restarting the application and without losing the context and application state. This feature does not rely on Visual Studio, even if you use Notepad to modify the code, you can also perform hot reloading.

In addition, this is only the first step for .NET 6 hot reloading, and hot reloading support will be enabled for all other types of .NET application development in the future.

.NET 6 Preview 3 released
.NET 6 Preview 3 released
.NET 6 Preview 3 released
.NET 6 Preview 3 released

Conclusion

There are actually more updates about ASP.NET Core and EntityFramework Core, but I won’t introduce them one by one here.

The above is part of the updated content included in .NET 6 Preview 3. Thanks for reading.

Leave a Comment