The best new features in .NET 6 (2023)

Microsoft Architect

By Joydip Kanjilal, Columnist, InfoWorld |

Microsoft .NET 6 marks a new era of developing performant, modern-day applications for web, cloud, desktop, and mobile devices. Here’s what’s new.

The best new features in .NET 6 (2)
(Video) .NET 6: New features in .NET 6 (includes Minimal APIs)

Microsoft .NET 6 is the culmination of the .NET unification that started with .NET 5. Cross-platform .NET 6 merges the .NET Core, .NET Framework, and Xamarin/Mono technologies into a single .NET Framework, unifying the SDK and runtime for desktop, mobile, web, and cloud applications.

Microsoft made .NET 6 generally available on November 9, 2021, alongside C# 10 and Visual Studio 2022. In addition to an improved developer experience overall, .NET 6 brings significant performance boosts compared to its earlier counterparts. In fact, .NET 6 is the fastest .NET yet. It’s also a Long-Term Support (LTS) release, which means Microsoft will support .NET 6 for three years.

It goes without saying that you must understand the new features of .NET 6 before you can take full advantage of them. This article discusses what’s new in .NET 6 and what it means to go forward as a C# 10 developer. You can download a copy of .NET 6.0 for Windows, Linux, and macOS.

Note that .NET 6 is supported in both Visual Studio 2022 and Visual Studio 2022 for Mac. However, .NET 6 is not compatible with Visual Studio 2019, Visual Studio for Mac 8, or MSBuild 16. You will need to upgrade to Visual Studio 2022 if you wish to use .NET 6. You can download Visual Studio 2022 here.

A unified and extended .NET platform

.NET 6 provides a unified platform for desktop, mobile, web, cloud, and IoT applications. The underlying platform supports applications of various types and makes it simple to re-use code across all applications. New features and enhancements have been introduced to ensure that code executing in the cloud, on a desktop, or on a mobile device all behaves the same way.

One of the most enticing enhancements is the .NET Multi-platform App UI (.NET MAUI). You can now write code that provides a modern client app experience across desktop and mobile operating systems in a single project. .NET MAUI became generally available in May.

(Video) C# 10 - New Features in .NET 6

Note that neither .NET 5 nor .NET 6 is a replacement for the legacy .NET Framework. Microsoft has no plans to port Web Forms, Windows Communication Foundation (WCF), or Windows Workflow Foundation (WF) from .NET Framework to .NET 5 or .NET 6. However, there are supported alternatives for each of these technologies as shown below.

  • Web Forms can be replaced by ASP.NET Core Blazor or Razor Pages.
  • Windows Communication Foundation (WCF) can be replaced by gRPC.
  • Windows Workflow Foundation (WF) can be replaced by open source CoreWF.

What’s new in .NET 6

Let’s now look at the new features and improvements in .NET 6.

Improved performance

Performance is considerably improved, particularly for file I/O, resulting in reduced execution time, latency, and memory use. The FileStream class has been re-written to improve async file I/O performance. The implementation on Windows no longer uses blocking APIs, which makes it several times faster.

The Just in Time (JIT) compiler has been updated. There have been improvements in the garbage collector as well. System types such as Guid and string have been improved considerably.

Profile-guided optimizing

Profile-guided optimizing (PGO) is a compiler optimization technique and a new feature introduced in .NET 6 that allows the JIT compiler to generate optimized code according to the types and codes that are most often used.

Unified platform support

Microsoft’s work toward a unified platform for .NET applications started with .NET 5. The idea was to provide a uniform platform for developing apps that can run on any device and any operating system. Thus all .NET 6 applications, across web browser, desktop, cloud, IoT, and mobile devices, use the same .NET libraries.

New APIs introduced

New APIs have been added for HTTP/3, JSON, mathematics, and more.

Security improvements

There have been significant improvements in security, such as support for the ChaCha20Poly1305 encryption scheme, OpenSSL, and “defense in depth” runtime mitigations.

C# 10 and F# 6 improvements

The considerable improvements in C# 10 include the introduction of new lambda capabilities, record structs, and implicit using. There have been improvements to F# 6 as well that include pipeline debugging and Task-based async.

Improvements in JSON APIs

Improvements to JSON APIs bring more capabilities and enhanced performance. A new source generator for System.Text.Json has been introduced that eliminates the need for runtime reflection and code creation and allows for the production of appropriate serialization code at build time.

(Video) .NET 6 deep dive; what's new and what's coming | OD485

Improvements in cloud diagnostics

Cloud diagnostics have been enhanced with the addition of OpenTelemetry and dotnet-monitor, which are currently in production and accessible with Azure App Service.

Improvements in code quality

Source generators and analyzers have been introduced to help you write better, safer, and faster code.

Hot Reload

Hot Reload is one of the most striking new features added in .NET 6. You can take advantage of this feature to modify the user interface when your application is in execution. You can see the changes reflected as soon as you save them—you don’t need to restart the application. This feature boosts developer productivity considerably.

DateOnly and TimeOnly structs

This is a long-awaited feature in .NET. You can now set values to an object that is just a date or a time. Below are a few examples that illustrate how you could use DateOnly and TimeOnly structs.

var dateNow = new DateOnly(2021, 11, 17);
var newDate = dateNow.AddDays(7);
var timeNow = new TimeOnly(12, 0, 0);
var newTimeNow = timeNow.AddHours(5);

Support for async streaming

With .NET 6, you now have support for async streaming, using IAsyncEnumerable<T>, which allows you to stream data from the server without any buffering.

Targeting .NET 6

When you create a new .NET 6 application in Visual Studio 2022, the TargetFramework node should refer to .NET 6. A typical .csproj file created in .NET 6 will look like this:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

You can also specify a flavor of .NET 6 if you’re targeting a specific operating system:

  • net6.0-android
  • net6.0-ios
  • net6.0-maccatalyst
  • net6.0-tvos
  • net6.0-windows

What’s missing from .NET 6?

Note that some technologies were dropped in .NET 5. Hence, they are not a part of .NET 6 as well. These include the following:

  • ASP.NET Web Forms. The legacy ASP.NET Web Forms is no longer supported. You might want to use Blazor, Angular, or React instead.
  • Windows Communication Foundation (WCF). Microsoft had intended to bring WCF back to the .NET ecosystem, but dropped the idea after determining it would take some three years to do so. Microsoft recommends using gRPC, Google’s open source RPC framework, as an alternative. (For a guide, see my article here.)
  • Windows Workflow Foundation (WWF). WWF, a workflow framework that has been in use for many years, has being dropped from .NET as well.

The .NET release schedule

After the release of .NET 5, Microsoft promised to deliver a new version of .NET in November of every year. The following table lists the release schedule for .NET.

.NET Framework was deprecated after .NET 5 was released. This means you can still use .NET Framework on versions of Windows that support it. However, with Microsoft shortening the lifecycles of the operating systems, you could easily end up using a Windows version whose end-of-life has already arrived.

(Video) .NET 6 | Everything You NEED to Know

Microsoft provides Long-Term Support for .NET 6. It should be noted that LTS releases are usually supported for a period of three years from the date of release. Thus, Microsoft plans to support .NET 6 until November 2024. The next LTS release, .NET 8, is due in November 2023.

A new era of .NET development

From a better, faster, and unified runtime to an improved developer experience, the sweeping benefits of .NET 6 make it the most significant release in the .NET ecosystem since .NET 4. .NET 6 is both the fastest .NET yet, with a smaller footprint and reduced resource consumption, and the most developer-friendly, with many language enhancements and features like Hot Reload.

Most important, .NET 6 takes us a big step toward easing the development of cross-platform applications. It is a cross-platform framework that allows you to create native mobile and desktop applications for Android, iOS,macOS, and Windows, without having to maintain multiple codebases to support all these different platforms.

Microsoft .NET 6 not only establishes a new foundation for all future .NET platforms. It marks a new era of developing performant, modern-day applications for multiple operating systems and architectures in .NET. With a unified platform, better language maturity, and improved developer tools, .NET 6 is well set to be the default Microsoft development platform for years to come.

Related:

  • Microsoft .NET
  • C#
  • Software Development

Joydip Kanjilal is a Microsoft MVP in ASP.Net, as well as a speaker and author of several books and articles. He has more than 20 years of experience in IT including more than 16 years in Microsoft .Net and related technologies.

Follow

(Video) Best NET 6 Features

Copyright © 2022 IDG Communications, Inc.

FAQs

Is .NET 6 better than .NET framework? ›

NET 6 can run on natively Mac and Linux, . NET Framework cannot and you would need a third-party runtime like Mono for that capability. . NET 6 you can compile the framework into your application so the separate framework does not need to be installed to run your app. .

Why .NET 6 is faster? ›

Improved performance

The FileStream class has been re-written to improve async file I/O performance. The implementation on Windows no longer uses blocking APIs, which makes it several times faster. The Just in Time (JIT) compiler has been updated. There have been improvements in the garbage collector as well.

Is .NET 6 still .NET core? ›

NET 6, which is the most recent LTS version. While support for . NET Core 3.1 ends in December 2022, support for . NET 6 will continue until November 2024.

What is the latest version of .NET 6? ›

. NET 6 is the latest version of . NET that was released in Nov 2021.

Is .NET 6 production ready? ›

NET 6 will be supported for three years. Developers have already started upgrading applications to . NET 6 and we've heard great early results in production. . NET 6 is ready for your app.
...
Dynamic PGO.
MethodMeanCode Size
PGO Enabled0.7071 ns105 B
1 more row
8 Nov 2021

Do we need VS 2022 for .NET 6? ›

. NET 6 is supported by Visual Studio 2022 and Visual Studio 2022 for Mac (and later versions).

How much faster is .NET 6? ›

Without making any changes whatsoever to our code, our benchmarks improved by roughly 20% simply by running the code on . NET 6.0 instead of . NET Core 3.1. We've not had to release a new version—the existing version published on NuGet (which targets netstandard2.

Which .NET language is best? ›

C#. C# is rapidly becoming Microsoft's most popular language; a mix between Java and C++ (minus many of the problems in Java and C++). C# development is popular for everything from IoT programming to mobile application development. Many find C# easier to learn than the other C and Java languages.

Should I update to .NET 6? ›

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 .

Should I migrate to .NET 6? ›

You should always migrate to the latest version of . NET Core available i.e. . NET 6 instead of the older versions. If you are porting a library that will be used in both .

Should I use dotnet 5 or 6? ›

NET 6.0 has more advantages than working with the . NET 5.0 as . NET 6.0 has more improvement on the performance which also includes some major advantage as it has intelligent code editing and also it is called the fastest full-stack web framework.

How long is .NET 6 supported? ›

Supported versions
VersionOriginal release dateEnd of support
.NET 7November 8, 2022
.NET 6November 8, 2021November 12, 2024
.NET Core 3.1December 3, 2019December 13, 2022

Is net 6 open source? ›

All aspects of . NET are open source including class libraries, runtime, compilers, languages, ASP.NET Core web framework, Windows desktop frameworks, and Entity Framework Core data access library, and more.

Is .NET good in 2022? ›

Dot Net is one of the most popular and widely used frameworks for developing web and mobile applications that help businesses achieve new heights smoothly. The demand for dot net development companies is overgrowing, and every industrial sector is inclined towards using it.

Is .NET Core 6 stable? ›

Microsoft officially released long term stable version . NET 6 on November 8, 2021.

What is the most current .NET version? ›

NET Framework 4.8. To determine the installed . NET version, use the following Release DWORD: 528449 (Windows 11 and Windows Server 2022)

Is there a .NET 7? ›

You can download the free .NET 7 release today for Windows, macOS, and Linux. .NET 7 provides a straightforward upgrade if you're on a .NET Core version and several compelling reasons to migrate if you're currently maintaining a .NET Framework version. Visual Studio 2022 17.4 is also available today.

Is .NET 6 backward compatible? ›

NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the . NET Framework.

Does VS code support .NET 6? ›

Summary. We have set up Visual Studio Code to work with C# 10 and . net 6.0.

How do I know if NET 6 is installed? ›

NET Core is installed on Windows is: Press Windows + R. Type cmd. On the command prompt, type dotnet --version.

What a .NET developer should know in 2022? ›

Expertise in Coding

Proficiency in writing code is essential for creating applications for whatever platform be it web, mobile, or desktop. A dot net developer should have proficiency in programming languages like C#, C++, F#, VB.NET, etc for creating applications on .

Is VS 2022 better than VS 2019? ›

Visual Studio 2019 had several features that improved overall accessibility, and VS 2022 improved and added even more accessibility features. Instead of relying on plugins or add-ons, users can modify the interface to improve visibility and organization and work better with approved extensions.

Does .NET 6 support Visual Basic? ›

NET 6 supports F# 5.0 and Visual Basic 16, with additional languages expected this year. Moreover, the installation includes a runtime for new console and server programs, Windows desktop applications, and an ASP.NET Core web application runtime.

Is .NET Core faster than Java? ›

Java is an object-oriented, class-based, higher-level programming language designed to have a few implementation dependencies. . NET has components that can be used again, which speed up the process.

Is .NET Core faster than node JS? ›

NET Core has an easier time working with CPU-intensive tasks and rendering static pages since the in-built IIS server kernel caching makes this process very straightforward. Therefore, . NET core vs node. js performance offers different advantages for various projects.

Is .NET Core faster than .NET framework? ›

. NET Core is faster than . NET Framework because the architecture of . NET Core is written or restructured from scratch to make it a modular, lightweight, fast, and cross-platform Framework.

Which web language is faster? ›

js one of the fastest programming language in terms of speed today. Node. js compiles fast also because it runs on Google's V8 JavaScript engine that compiles the code into native machine instructions to make it run fast. Thus, allowing you to build your applications more quickly.

Which is the No 1 programming language? ›

JavaScript is the most common coding language in use today around the world. This is for a good reason: most web browsers utilize it and it's one of the easiest languages to learn.

Does .NET have future? ›

NET's product cycle is coming to a close. While it's not in the immediate future, it certainly has already been hit with an end date, with v. 4.7 ending in 2022.”

Can I use .NET 6 dll in .NET framework? ›

Yes, you can load . NET Framework assemblies into . NET Core 5 and 6.

How can I update without losing data? ›

How to Update Your Android to Marshmallow Without Losing Data?
  1. Connect Android device to a computer. Install EaseUS MobiSaver for Android on your computer, and correctly connect your Android phone to it with a USB cable. ...
  2. Scan all Android data. ...
  3. Save Android data to the computer.
17 Mar 2022

Is .NET still in demand? ›

It has been one of the essential technologies for many years and is still very popular today. In fact, according to Stack Overflow's survey of developers' preferred programming languages, . NET is still the top choice for web development.

How do I convert .NET framework to .NET 6? ›

NET 6 will put you in a very good position to move to Microservices as the next step.
  1. Step 1 - Understand Your Dependencies. ...
  2. Step 2 - Upgrade the Visual Studio Project (csproj) Format. ...
  3. Step 3 - Multi-target . ...
  4. Step 4 - Fix Code Issues. ...
  5. Step 5 - High-Level Projects. ...
  6. Step 6 - Testing.
12 Dec 2021

Which .NET framework is best? ›

A cross-platform and open-source framework, . NET Core is best when developing applications on any platform. . NET Core is used for cloud applications or refactoring large enterprise applications into microservices.

Is dotnet better than Python? ›

Python seems excellent for data analytics and machine learning while . NET is great for developing scalable and robust business applications. In terms of community support and several exciting open-source projects, python is better.

What is new in core 6.0 in asp net? ›

Hot reload: In Asp.net code 6.0, Hot Reload is introduced as a new feature. It means we can apply changes to Razor, C#, and CSS source lines into your handling operation during development time without rebuilding and resuming the operation. Async streaming: Asynchronously stream data from the server without buffering.

What language does .NET use? ›

C# (pronounced “see-sharp”) is the actual coding language that we write inside of the . NET framework. C# is an object-oriented programming language, meaning it can increase productivity in the development process.

Is .NET front end or backend? ›

. Net comprises both frontend and backend languages. As for example, ASP.NET is used as backend and C# & VB.NET are used for frontend development.

Is .NET easy to learn? ›

Dot net is a user friendly and its very easy to learn .. I recommend to start with java because it is a strong and professional language and relatively simple compared to C + +.

Is .NET good for career? ›

NET good for a career? . NET, being one of the favorite frameworks for developers, offers several opportunities. With its usage in enterprise-level development, a job in a high-tech company is highly likely.

Is Java or .NET better? ›

Java fetches most syntax from C and C++. Since it is a platform-independent language, you can run Java on various platforms . Net works on a common language infrastructure, supports arrays, type checking, checks variables and garbage collection. Hence, it provides durability, productivity and robustness.

Is .NET better than Java? ›

NET makes use of natively compiled languages such as C# and C++. They are faster and use less memory than Java. . NET also allows for code optimization and writing less code, which improves performance. Shorter code also means less time spent on code maintenance and simpler debugging.

What are the new features in .NET Core? ›

Leverage ASP.NET Core New Features
  • SignalR Java Client. Another ASP.NET Core latest feature includes the addition of a Java client for SignalR. ...
  • Self-hosted Web Apps. ASP.NET Core applications no longer require IIS for hosting. ...
  • Minimal Code. ...
  • Razor Pages. ...
  • Swagger Open APIs. ...
  • Easy Compilation.
4 Feb 2019

Is NET 6 long term support? ›

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

What is the difference between .NET 5 and .NET 6? ›

NET 5.0 as . NET 6.0 has more improvement on the performance which also includes some major advantage as it has intelligent code editing and also it is called the fastest full-stack web framework. The . NET 6.0 also provides better performance in the File Stream.

What are the new versions came in NET? ›

NET version, use the following Release DWORD:
  • 528449 (Windows 11 and Windows Server 2022)
  • 528372 (Windows 10 May 2020 Update and Windows 10 October 2020 Update and Windows 10 May 2021 Update)
  • 528040 (Windows 10 May 2019 Update and Windows 10 November 2019 Update)
  • 528049 (all other OS versions)
30 Aug 2022

What is new in core 6 in asp net? ›

ASP.NET Core includes improvements in minimal APIs, ahead-of-time (AOT) compilation for Blazor WebAssembly apps, and single-page apps. In addition, Blazor components can now be rendered from JavaScript and integrated with existing JavaScript based apps. For more information, see What's new in ASP.NET Core 6.

What is .NET 6 runtime? ›

.NET Desktop Runtime 6.0.8

The .NET Desktop Runtime enables you to run existing Windows desktop applications. This release includes the .NET Runtime; you don't need to install it separately.

Is NET 6.0 backwards compatible? ›

New Nuget package

Net 6 release is as backwards compatible as possible, there are some breaking changes that we couldn't avoid during development. This means that the upgrading from . Net Framework to . Net 6 is a bit more involved than just updating the Nuget.

What languages does .NET 6 support? ›

NET 6 has language support for C# 9.0, F# 5.0, and Visual Basic 16.0, with more to come as the platform evolves throughout 2021. The download includes a runtime for new console and server apps, one for Windows desktop apps, and one for ASP.NET Core web apps.

How do I migrate from .NET 5 to .NET 6? ›

Migrating from .

NET 5. In Visual Studio, simply right click on your project in Solution Explorer and choose Properties. Under Application > General > Target framework, choose . NET 6.0.

What is the most recent .NET framework? ›

NET Framework 4.8 is included with: Windows 10 May 2021 Update.

When did .NET 6 release? ›

November 8, 2021

What is .NET and its features? ›

The . NET Framework is an open-source developer platform you can use to create a broad range of applications. This free cross-platform framework accepts multiple coding languages and features large code libraries that make it easy to build applications for mobile devices, desktops, the web and the Internet of Things.

Videos

1. 4 new useful APIs in .NET 6
(Nick Chapsas)
2. 7 awesome improvements for LINQ in .NET 6
(Nick Chapsas)
3. What's new in .NET 6 - part 1
(dotnetFlix)
4. What's New in .NET 6 and C# 10? | .NET 6 New Features | C# 10 New Features | DotNetTricks
(ScholarHat By DotNetTricks)
5. The top 10 best new features in C# version 6 to 9 - Chris Klug
(NDC Conferences)
6. .NET 6 Features in ACTION | ASP.NET Core WebAPI
(Claudio Bernasconi)
Top Articles
Latest Posts
Article information

Author: Jeremiah Abshire

Last Updated: 02/02/2023

Views: 6046

Rating: 4.3 / 5 (54 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Jeremiah Abshire

Birthday: 1993-09-14

Address: Apt. 425 92748 Jannie Centers, Port Nikitaville, VT 82110

Phone: +8096210939894

Job: Lead Healthcare Manager

Hobby: Watching movies, Watching movies, Knapping, LARPing, Coffee roasting, Lacemaking, Gaming

Introduction: My name is Jeremiah Abshire, I am a outstanding, kind, clever, hilarious, curious, hilarious, outstanding person who loves writing and wants to share my knowledge and understanding with you.