DEV Community

Cover image for .NET 6 is HERE! 5 Features that will blow your mind 🤯

Posted on • Updated on • Originally published at

.NET 6 is HERE! 5 Features that will blow your mind 🤯

After so many months of speculation, leaks, and previews, Microsoft officially releases .NET 6 RC1. This is the first of the 2 versions that “go live” and are supported in production.

This release brings many new features, both new features and performance and optimization improvements. We are going to see The 5 Most Important .NET 6 Features.

⚡Profile-guided optimization (PGO)

Profile-guided optimization (PGO) is one of the most important capabilities for the vast majority of development platforms that exist today. This novelty is based on assuming that the code that is executed at the beginning is (often) uniform, which can lead to a much better performance if it is exploited.

The number of PGO possibilities is enormous, the most important of which are:

  • Reduce the size of the final compiled file, compiling low-use code with lower quality.

  • Compile the startup code with higher quality (unlike the previous function).

  • Achieve greater productivity since the .NET PGO system has been rebuilt from scratch to offer a much greater benefit.

That rebuild is because PGO has been used in .NET for 20 years and from the beginning, that system was very difficult to use (apart from being proprietary). This has been the main reason why almost Microsoft team don’t used it despite the great benefit it generated. (This change has been primarily initiated by the new Crossgen2 technology).

The main reasons to enable PGO are:

  • The simple integration of PGO data in the application and the construction flow of the library itself.

  • The tools to process the PGO data in different ways (transformed and differentiated).

  • The “friendly text” format for source control for PGO data.

  • PGO data collection tools in applications, both in production and in test environments.

💥Dynamic PGO

Microsoft describes the new Dynamic PGO feature as the mirror image of the static PGO system I just described. Where the static PGO integrates with Crossgen2, but in this case, the dynamic PGO integrates with RyuJIT.

Unlike the Static PGO (which requires separate training and use of special tools), the Dynamic PGO is automatic. Just use the running application to collect the necessary data. Another difference is that while the Static PGO data is stored, the Dynamic PGO data is lost at the end of the application execution (Microsoft compares Dynamic PGO with a JIT tracing).

Right now Dynamic PGO is available and enabled with the following environment variables:

DOTNET_TieredPGO = 1
DOTNET_TC_QuickJitForLoops = 1
Enter fullscreen mode Exit fullscreen mode

The main utilities of Dynamic PGO are:

  • The ability to transform an interface method call into a non-virtual call, which leads to a significant performance increase.

  • The combination of Crossgen2 and Dynamic PGO, with which we can learn to compile methods sparsely depending on the use.

  • Crossgen2’s ability to communicate (through some weighting) which methods are more likely to benefit from higher compilation levels at runtime.


As we have already talked a bit about Crossgen2, it is a big step forward for early build for the platform. The most important feature is that the goal of Crossgen2 is to be a standalone compiler.

To understand this we are going to go to Crossgen1, which was simply a separate compilation of the runtime with only the necessary components to allow the generation of code. That approach that was given at the time generated many problems.

Today, Crossgen generates R2R code for all methods in an assembly (this includes the SDK and runtime). The problem with this is that it is a waste, since most likely more than half of them would be better left at runtime.

To go back in time, in .NET Core 3.0 it was used to remove about 10MB from the Linux runtime distribution. Now Microsoft will try to identify much more than 10MB in .NET 7.

✨Control-flow Enforcement Technology (CET)

This Intel technology is a security feature available on most newer processors, both from Intel and AMD. Adds hardware features that protect against the most common types of flow control hijack attacks.

With CET shadow stacks, the operating system and processor can trace the control flow calls and returns in a thread in the shadow stack in addition to the data stack, and thus be able to detect unintended changes in the flow of control. . The shadow stack is protected from memory accesses by application code and helps defend against attacks involving return-oriented programming (ROP).


This is the new version of HTTP. It brings many new features and performance features compared to previous versions of HTTP by using the new connection protocol: QUIC.

QUIC uses UDP and has integrated TLS, this allows to establish connections much faster. Unlike TPC, QUIC connections are independent of IP address, this allows mobile clients to move between mobile data and Wi-Fi networks maintaining the same logical connection and thus be able to continue with long downloads.

Of course, .NET 6 doesn’t include support for HTTP/3 for macOS, mainly due to the lack of a TLS API that is compatible with QUIC.
.NET 6 Conclusion

The news and features of .NET 6 are many, most of them have not been fully exploited and we will have to wait for Microsoft to discuss them in depth in the not too distant future.

Microsoft says:

“It’s inspiring to see the new features in .NET 6 that will lay the foundation for what’s coming next. These are big-bet features that will push the platform forward in both obvious and non-obvious ways.”

If you liked this article, don’t forget to FOLLOW US, so that you can be one of the first to read what’s new in .NET.

Top comments (17)

zaichengpao profile image

A lot of coffee haha☕☕☕☕☕ Great article, congratulations!

bytehide profile image

Hahaha thanks!

jespana8 profile image
Juan España

While (day)

bytehide profile image

or, ++☕; ?

devoops profile image


bytehide profile image

Too much coffee ! LOL

ruifgdias profile image
Rui Dias

while (1) { ☕ }

👍🏻 👏🏻

imran28 profile image


bytehide profile image

All with caffeine? Lots of power! haha

jabbalaci profile image
Jabba Laci

I read it while I was drinking my coffee, so it was a good and pleasant read :)

bytehide profile image

Hahaha a very good way to read the articles!

creedscode profile image

How much? Yes

bytehide profile image


ruyut profile image


hasibul2363 profile image

☕ ++

totitolvukall profile image
Thor (Þór)

No less than one per hour. If I can't thread a running sowing machine at the end of the day, it must have been a short day!

ascot31 profile image
Alvaro Brena