It is our pleasure to announce that the NET 6 framework has already been implemented with all the features like debugging, testing, and optimization on their way. Perhaps expecting something radically new in RC versions is no longer worthwhile. Instead, let's take a closer look at .NET 6 and try to understand why this version is better than the previous one.
Each time a new version of .NET is released, there is a lot of talk about how much better it will be than the previous version.
It is common for writers of press releases about the release of the new version to exaggerate its benefits, while keeping silent about its shortcomings. After reading all seven press releases and reviewing a large number of GitHub tickets, we were able to understand the true benefits. To better understand my point, let's look at the benefits of .NET 6.
Microsoft has completed its .NET unification initiative, which began with .NET 5 and will continue with .NET 6. The following features are available in the .NET 6 ecosystem:
As part of the long-term support program (LTS), .NET 6 will have long-term support for a period of three years.
By default, preview features are disabled. Also, if they are not suitable for production use, they may be removed in a future version.
FileStream
Windows users will benefit from a new version of the System.IO.FileStream type written specifically for .NET 6.
Profile-guided optimization
Optimizing code based on the type and code path most frequently used by the user is called profile-guided optimization (PGO).
Crossgen2
The successor to Crossgen has been introduced with .NET 6, Crossgen2.
Arm64 support
.NET 6 also supports macOS Arm64 (or "Apple Silicon") and Windows Arm64 operating systems, both natively and via x64 emulation.
Hot reload
The hot reload feature allows you to modify your app's source code and apply the changes instantly to your application. With this feature, you won't need to restart the app between editing.
.NET MAUI
A release candidate of .NET Multi-platform App UI (.NET MAUI) will be available in the first quarter of 2022, followed by general availability (GA) in the second quarter.
C# 10 and templates
Among the innovations in C# 10 are global using directives, file-scoped namespace declarations, and record structs.
Performance has always been a priority for .NET developers. On the one hand, the language and framework are constantly improving and adding new features - ref structs, stackalloc, System.Span *T>, and so on. With each new release of .NET, new optimizations are added, such as tiered compilation, compilation to native code, and, of course, advanced JIT compiler optimizations. When these tools are used as intended, they produce the desired results, which can be seen clearly in the graphs of key performance indicators in real combat situations.
NET 6 introduces three new tools that promise even greater efficiency gains. The new tools will benefit both developers and apps running in production. During debugging, we refer to pumped pre-compilation (using Crossgen2) and profiling-based optimization (PGO), as well as hot reloading of applications.
Please keep in mind that some of the tools presented here are radical reworks of existing tools. Even though this revision has opened up new and exciting possibilities.
A number of improvements have been added to F# 6 as well as to F# Interactive. If you want to find out more, you can find out what has changed in F# 6.
The Visual Basic experience in Visual Studio and the startup of Windows Forms projects have been improved compared to previous versions.
Several components have been moved into new, optional SDK workloads to reduce the size of the .NET SDK. If you're using Visual Studio for the first time, it will take care of installing any SDK workloads you need.
System.Text.Json has been significantly improved in .NET 6, so that it is now an "industrial strength" serialization solution.
In .NET 6, System.Text.Json has a new source generator. JsonSerializer has a variety of configuration options. You can trim assemblies, increase performance, and reduce memory usage.
There is now a writable document object model (DOM) in addition to the existing read-only document object model (DOM). In situations where POCO types cannot be used, the new API provides a lightweight serialization alternative. Moreover, it simplifies navigation to a subsection of a large JSON tree and allows reading of arrays from that subsection or deserializing of POCOs. There are four types supporting the writeable DOM:
A new version of HTTP, HTTP/3, is supported in preview in .NET 6. In addition to resolving a few existing performance and functional challenges, QUIC is a new underlying connection protocol for HTTP/3. QUIC enables roaming between cellular and Wi-Fi networks, establishing connections more quickly and independently of IP addresses.
In .NET 6, OpenTelemetry support has been enhanced, which is a collection of tools, APIs, and SDKs for analyzing the performance and behavior of your software. This namespace contains the APIs supporting the OpenTelemetry Metrics API specification.
.NET 6 adds the Control-Flow Enforcement Technology (CET) and Write Exclusive Execution (W*X) security mitigations.
Only unused assemblies were trimmed in .NET 5. .NET 6 trims unused types and members as well.
A number of new code analyzers are included in the .NET 6 SDK that deal with API compatibility, platform compatibility, trimming safety, etc.
With .NET 6, you can use Application i known that templates for C# Windows Forms applications have been updated.
.NET SDK build now includes the source tarball, which contains all the .NET SDK source code. Using this source tarball, organizations like Red Hat can build their own version of the SDK.
There are now additional OS-specific target frameworks (TFMs) for .NET 6, such as net6.0-android, net6.0-ios, and net6.0-macos.
Various operators are represented by these interfaces, for example, IAdditionOperators represents the + operator. NuGet package System.Runtime.Experimental contains the interfaces.
NuGet library developers can validate well-formed and consistent packages using new package-validation tooling.
Nullability information is provided by the following new APIs in .NET 6:
As you know, the benefits of JIT compilation come at a cost. In particular, the increased time to "warm up" the application at startup, since the JIT compiler needs to grind too much IL-code at once. They have already tried to solve this problem by compiling applications directly into native code, such a technology already exists and is called Ready To Run. But in the new version of the framework, it has been significantly redesigned.
The old pre-compilation technology was too primitive and could only generate native code for platforms where the crossgen utility was running. In managed code, it was completely rewritten from scratch and named Crossgen2. In addition to optimizations, it offers new opportunities for using different compilation strategies across different platforms (Windows/Linux/macOS/x64/Arm). All of this is possible because the utility is now designed differently.
Basically, Crossgen2 parses the IL code into an application graph. In this case, he launches a JIT compiler for the required platform inside himself. This compiler analyzes the compiled graph and creates native code, applying various optimizations if necessary. As a result, the Crossgen2 utility can be run on both x64 and Arm64 platforms while generating native and even optimized code. However, it also works the other way around.
Currently, the .NET SDK is compiled with Crossgen2, and the old crossgen utility has been retired.
The compiler analyzes the results of profiling, and it begins to identify the most frequently used places in the code and optimizes them more carefully.
Sources: What’s new.Dot NET 6.
https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-6
Nataliya Oteir