Under the hood with .NET 6

The next release of the .NET platform is around the corner. The new annual cadence of releases makes .NET 6 the first long-term support release of the unified .NET. That makes it a more important event than most as it’s the first one that organizations can really trust to use as the foundation of their development strategy.

Microsoft recently published its first release candidate, one of two that will come with a “go live” license that ensures Microsoft support for production applications. This is always a big step. At this point, what had been used for prototypes and other tests gets used at scale, revealing any bugs. That’s why Microsoft makes support available, so the .NET team is able to see the edge cases that it couldn’t reach in its own tests.

Should you begin to switch to .NET 6? Certainly, if you’re already using .NET 5 you should find migrating relatively easy, with the new release adding plenty of new features. Migrations from the .NET Framework remain harder, though .NET 6 adds more compatibility features. Still, there’s enough of a difference between the two platforms that migrating code will be a significant project. Even so, it’s probably a good time to start any migrations, with support readily available with a long-term release as a target.

You can download the current runtime and installers from Microsoft now, with development tool support in the latest preview builds of Visual Studio 2022 (which should launch alongside .NET 6 at .NETconf in November). A version of Visual Studio 2022 for macOS with .NET 6 support is currently in private preview.

Taking off the covers of a new .NET compiler

For most of us, the languages we use are our main touchpoint for .NET, and like previous releases, .NET 6 brings new versions of its main tools. However, the most important parts of a new version are under the hood in the tools that take our code and run it on target hardware, from pocketable ARM devices to massive multicore cloud x64 systems.

A lot of the work in .NET 6 has been in improving its compilers, working on optimizing code, using profile-guided optimization inside the project to produce optimized runtime libraries. It’s perhaps best thought of as a teaser for .NET 7. You can get the benefit of static profile-guided optimization (PGO) in your code, but you can’t use it yourself yet. At the same time, there’s an opt-in dynamic PGO tool built into the .NET JIT compiler. It’s a good way of improving the performance of running code, but any optimizations will be lost between runs.

Copyright © 2021 IDG Communications, Inc.

Source link