.NET 6 in a Nutshell — 7 Reasons WHY It’s Worth the Upgrade

.NET 6 is finally out and set to become the primary version until Nov. 2024. Let's explore what improvements it provides, how it compares to .NET 5, and whether you should consider upgrading.

readtime
May 12, 2022

TL;DR

Introduction

Following more than a year of intensive development effort by the .NET team, .NET 6 is finally out. Many .NET developers, including us here at Brainhub, believe .NET 6 is Microsoft’s shiniest, fastest .NET yet. Billed as the final step in a .NET unification vision, .NET 6 unifies the SDK, base libraries, and runtime across various app platforms.

Depiction of .NET 6 influence on the unification of the .NET platform.

In this article we’re focusing on a few high-level details to help you get a hold of what’s going on. After all, .NET 5 lots its support in May 2022, which means you’ll have to migrate to .NET 6 sooner rather than later.

.NET 6 release date

After seven exhaustive previews, Microsoft finally released the long-term stable version .NET 6 on November 9, 2022. It includes around ten thousand git commits. This is the first-ever release that natively supports Apple Silicon (mac OS Arm 64) and provides support for Windows Arm64.

Depiction of .NET 6 release timeline.

According to a bulletin published by Microsoft, .NET 6 brings with it a slew of big-bet features along with “massive” gains in both optimization and performance.

.NET 6 new features

Before we delve into the distinct features of this framework, it’s important to understand that with .NET 6, and beyond, there will be just one .NET, and it’s just .NET.

This perfectly aligns with Microsoft’s long-term vision of transforming the Windows-only, proprietary .NET Framework into one open-source, cross-development offering for all types of .NET projects (including the compatibility with .NET MAUI).

That said, there are several new features and upgrades mentioned in the official .NET 6 announcement. Here are the most outstanding ones:

Depiction of .NET 6 new features.

1. C# 10 language update

.NET 6 brings a ton of new features to C# languages. It continues down the road of language simplification, a vision that started with C# 9. Some of the features added to C# 10 include:

  • global using directives,
  • enhanced #line pragma,
  • record structs,
  • improved lambda syntax,
  • improvement of structure types,
  • extended property patterns.

Additionally, most of the .NET 6 project templates are based on C# 10 changes. The new templates are much cleaner and simpler than before, making it easier for new developers to write programs.

2. F# 6 and Visual Basic

F# 6, an upgrade to Microsoft’s open-source, multi-paradigm programming language, is now officially available as part of .NET 6. Specifically, F# 6 adds several improvements to the F# language and the F# interactive.

As for Visual Basic, it’s received improvements in the Visual Studio Experience as well as Windows Forms project startup.

3. HTTP/3

.NET 6 supports the new version of HTTP, which is HTTP/3. HTTP/3 solves the all-too-familiar head of line blocking problem present in HTTP/2 by using a new underlying connection protocol called QUIC.

QUIC uses UDP and has built-in TLS, so it’s faster to establish connections since the TLS handshake occurs as part of the connection.

4. Cloud diagnostics

.NET 6 reduces your computational costs and enhances performance if you operate on the cloud. Features like .NET monitor and OpenTelemetry bring about this functionality.

.NET monitor makes it easy to collect diagnostic data from .NET process. OpenTelemetry, on the other hand, allows you to better analyze your software behavior and performance.

5. Package validation tooling

.NET 6 has a package validation feature that allows developers to ensure that their code is well-formed and consistent during package development.

Developers can now compare and validate their latest project against the previous one and against prior versions of the framework and runtime.

With that in mind, package validation tooling can really be a boon to the entire .NET ecosystem. Since you no longer create a package that’s not validated, the .NET ecosystem will be much safer.

6. Enhanced security

Security has long been a top priority for the .NET platform, and this time, .NET 6 is equipped with all the top-notch security features you’d want in a development framework. These include:

  • threat modeling,
  • Control-flow Enforcement Technology (CET),
  • “write-exclusive execute” (W^X),
  • defense in depth mitigations,
  • cryptography.

On Linux, all cryptography operations rely on OpenSSL, while on Windows and macOS, this can be done with OS-provided functionality.

7. SDK workloads

SDK workloads were first introduced in preview 4 of .NET 6. With this feature, you can install only the SDKs that you want and need, rather than an “all-in-one” package. To put it simply, it’s nothing but a package manager for SDKs.

.NET 6 performance

Over the years, .NET framework has grown to be a very robust system. However, given its long history and evolution, it has somewhat been saddled with notable legacy dependencies and compromises along the way.

One of the main goals of .NET 6 was to break away from those limitations and give the framework a fresh start while opening up new horizons for developers — and that’s been the case so far. As we speak, there is virtually nothing you can’t do with .NET 6.

Here are a few note-worthy performance improvements you can expect in .NET 6:

Depiction of .NET 6 performance improvements.

1. Crossgen2

Crossgen2 is a tool that allows you to generate unique, native code in a ready-to-run format.

The ready-to-run format is primarily oriented toward being compatible across assemblies, and having the same compatibility guarantee as IL, while offering the performance benefits of ahead-of-time (AOT) compiled code.

Put differently, you’ll be able to use a single build machine to generate native code for all targets.

2. FileStream

FileStream for .NET 6 hardly lags. In fact, it’s much faster and more reliable, thanks to an almost entire rewrite.

3. Profile-guided optimization

Another big improvement in .NET 6 has been the introduction of profile-guided optimization (dynamic PGO). Essentially, dynamic PGO is a JIT-compiler optimization technique that allows JIT to collect additional information about surroundings (aka profile) in tier0 codegen in order to rely on it later during promotion from tier 1 to tier 2 for hot methods. The goal is to make the methods even more efficient.

Specifically, dynamic PGO allows you to optimize two key areas:

  • Profile-driving inlining: inliner relies on PGO data and can be very aggressive for hot paths
  • Guarded devirtualization: most monomorphic virtual/interface calls can be devirtualized using PGO data.

Combined, these performance improvements result in decreased execution time for your code as well as low latency and low memory use. It’s an area of .NET 6 that you can afford to ignore.

.NET 5 vs .NET 6 comparison

.NET 5 is the natural development and evolution of the .NET Core 3.1 and .NET 4.6 frameworks.

With .NET 5, your code and project files will look and feel the same no matter which type of app you’re building.

While .NET 5 bears some close resemblance to the newly released .NET 6, the two frameworks are distinctively different.

Here’s how:

.NET 6 vs .NET 5 comparison table.

1. Programming languages

.NET 5 comes with C #9 and F# 5 whereas .NET 6 packs C# 10 and C# 6.

2. Platforms

Depiction of .NET 6 supported processors.

Both .NET 5 and .NET 6 are supported on multiple operating systems, including Windows, Linux, Android, iOS /tvOS, and macOS. The only difference is that .NET 6 is further supported on Windows Arms64 and macOS Apple Silicon while .NET 5 is not.

3. Integrated development environment

.NET 5 works well with Visual Studio 2019 updated version 16.8 or any of the later versions.

In contrast, .NET 6 only works with Visual Studio 2022 and Visual Studio 2022 for MAC. If you want to use .NET 6, you will need to upgrade to Visual Studio 2022 (which is also now 64-bit).

4. Open-source

Both .NET 5 and .NET 6 are completely open-source and totally cross-platform.

5. Support

.NET 5 will reach end-of-support on May 8, 2022. After the .NET May updates, Microsoft will no longer provide servicing updates, including technical support and security fixes, for .NET 5.

.NET 6, on the other hand, is a long-term support (LTS) framework that will be supported for three years.

6. Speed

While .NET 5 runs relatively fast, .NET 6 is by far the fastest of all .NET versions in existence. The two are simply incomparable in this department.

Should I make the .NET 6 upgrade?

Definitely! Overall, .NET 6 is the far better choice between the two frameworks. It runs faster, produces more efficient code, and guarantees long-term support.

As such, upgrading from .NET 5 to .NET 6 shouldn’t be a question of if but rather when. The sooner you do it, the better for your product.

<span class="colorbox1" fs-test-element="box1"><p>Interested in upgrading to .NET 6?</p><p>Check the list of top .NET development vendors and find your perfect fit.</p></span>

.NET 6 vs .NET Core

To put it simply, .NET 6 is the latest version of .NET Core. Both .NET 6 and .NET Core play to Microsoft’s goal of having “just one .NET going forward.”

By definition, .NET Core is basically an open-source framework for developing windows, web applications, services, and mobile applications, and it can be run on Mac, Windows, and Linux. It is completely written from scratch.

.NET Core 2.0 arrived in 2017 as an open-source, cross-platform alternative to .NET Framework. However, it was not long before the platform lost its flagship name.

In a somewhat symbolic move, Microsoft dropped the “Core” moniker three years later in favor of .NET 5, .NET 6, and so on going forward. For many, the move illustrated Microsoft’s desire for the upcoming releases to bring new levels of unification to the entire .NET community.

Of course, .NET 6 is a huge improvement from .NET Core 2.0 and all other versions in between. It’s got far better features and significantly reduces the amount of boilerplate code developers have to write for their packages to come to life. So, in many ways, .NET 6 bridges the divide between .NET Core and .NET Framework.

.NET 6 hot reloading

Improved feedback loops are an integral part of the modern development story. Shortened times between a code change and it being reflected in your application’s output can make or break your flow. Thankfully, that’s about to change courtesy of .NET 6 Hot Reload feature.

Hot Reload was first introduced in the .NET 6 Preview 3 version. It allows developers to modify the UI when the application is still running.

That means you can make a wide variety of code edits to a running application, significantly reducing the time you need to spend waiting for apps to restart, rebuild, or re-navigate to the same spot you were after making a code change.

In terms of availability, you can access the Hot Reload feature through both Visual Studio 2022 and dotnet watch CLI tool. Best of all, you can use Hot Reload with a large variety of app types, from Blazor to ASP.NET Core to WinUI 3 and more.

When using Visual Studio 2022, simply start your .NET 6 app, make a supported edit, and then use the new “Hot Reload” button to apply those changes. Alternatively, you could apply changes on save through the drop-down menu on the same button.

When using the CLI, the .NET 6 Hot Reloading process is pretty much the same, only that this time, you’re launching your app using dotnet watch and not directly. Once that’s done, proceed to make any supported change. Upon saving the file, your changes will be instantly applied (like in Visual Studio Code).

If by any chance the edits are not supported, the details will be logged to the command window.

As you can see, .NET 6 Hot Reloading is quite straightforward and doable — even for beginner coders.

FAQ

What is .NET 6 framework?

.NET 6 Framework is a Windows-only version of .NET 6 for building any type of app that runs on windows.

Is .NET 6 available?

Yes. .NET 6 is currently available for Windows, macOS, and Linux. Click on this link to download .NET.

Is .NET 6 same as .NET Core?

Yes. Under the hood, the two are fundamentally the same. The only difference is that .NET 6 includes far more advanced features compared to the prior versions of .NET Core.

Does .NET 6 replace .NET Core?

Pretty much .NET 6 is an open-source and cross-platform framework, meaning that it automatically replaces .NET Core and .NET Framework with a single, more powerful, unified platform.

Conclusion

So there you have it — a high-level breakdown of .NET 6, Microsoft’s most proficient .NET yet. If you’re on .NET Core or .NET 5, you’ll want to upgrade as soon as you possibly can. Thankfully, the migration path is fairly minimal.

That being said, one thing is for sure: the entire .NET ecosystem will only get better from here on out. Failing to make the jump to .NET 6 means you’re locking yourself out of easier workloads, faster run times, higher code efficiency, and a more enjoyable programming experience overall.

<span class="colorbox1" fs-test-element="box1"><p>Need help deciding on the .NET 6 upgrade?</p><p>Feel free to contact us today and we’ll be happy to assist</p></span>

Bianka Pluszczewska
github
Editor

Read next

No items found...

Get actionable product building tactics in your mailbox, monthly.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
brainhub rates and rerences

Bye, waterfall. Hello, BizDevOps.

Join 1,200+ other tech leaders and get monthly insights on how to:

  • build superior products that users love
  • release software fast, often, and within budget
  • avoid tension between product and engineering teams
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

By submitting, you agree to receive our BizDevOps newsletter.