What's new in .NET 9

Learn about the new features in .NET 9 and find links to further documentation.

.NET 9, the successor to .NET 8, has a special focus on cloud-native apps and performance. It will be supported for 18 months as a standard-term support (STS) release. You can download .NET 9 here.

New for .NET 9, the engineering team posts .NET 9 preview updates on GitHub Discussions. That's a great place to ask questions and provide feedback about the release.

.NET runtime

The .NET 9 runtime includes a new attribute model for feature switches with trimming support. The new attributes make it possible to define feature switches that libraries can use to toggle areas of functionality.

The runtime also includes numerous performance improvements in the following areas:

  • Loop optimizations
  • Inlining improvements
  • PGO improvements: Type checks and casts
  • Arm64 vectorization in .NET libraries
  • Faster exceptions

For more information, see What's new in the .NET 9 runtime.

.NET libraries

System.Text.Json has new options that let you customize the indentation character and size of written JSON. It also includes a new JsonSerializerOptions.Web singleton that makes it easier to serialize using web defaults.

In LINQ, the new methods CountBy and AggregateBy make it possible to aggregate state by key without needing to allocate intermediate groupings via GroupBy.

For collection types, the System.Collections.Generic.PriorityQueue<TElement,TPriority> type includes a new Remove(TElement, TElement, TPriority, IEqualityComparer<TElement>) method that you can use to update the priority of an item in the queue.

For cryptography, .NET 9 adds a new one-shot hash method on the CryptographicOperations type. It also adds new classes that use the KMAC algorithm.

For reflection, the new PersistedAssemblyBuilder type lets you save an emitted assembly. This new class also includes PDB support, meaning you can emit symbol info and use it to debug a generated assembly.

The TimeSpan class includes new From* methods that let you create a TimeSpan object from an int (instead of a double). These methods help to avoid errors caused by inherent imprecision in floating-point calculations.

For more information, see What's new in the .NET 9 libraries.

.NET SDK

The .NET 9 SDK includes improvements to unit testing, including better integration with MSBuild that allows you to run tests in parallel.

For tools, a new option for dotnet tool install lets users (instead of tool authors) decide whether a tool is allowed to run on a newer .NET runtime version than the version the tool targets.

The terminal logger is now enabled by default and also has improved usability. For example, the total count of failures and warnings is now summarized at the end of a build.

For more information, see What's new in the SDK for .NET 9.

ML.NET

ML.NET is an open-source, cross-platform framework that enables integration of custom machine-learning models into .NET applications. The latest version, ML.NET 4.0, adds additional tokenizer support for tokenizers such as Tiktoken and models such as Llama and CodeGen.

.NET Aspire

.NET Aspire is an opinionated, cloud-ready stack for building observable, production ready, distributed applications.​ .NET Aspire is delivered through a collection of NuGet packages that handle specific cloud-native concerns, and is available in preview for .NET 9. For more information, see .NET Aspire.

ASP.NET Core

ASP.NET Core includes improvements to Blazor, SignalR, minimal APIs, OpenAPI, and authentication and authorization. For more information, see What's new in ASP.NET Core 9.0.

.NET MAUI

The focus of .NET Multi-platform App UI (.NET MAUI) in .NET 9 is to improve product quality. For more information about that and new features, see What's new in .NET MAUI for .NET 9.

EF Core

Entity Framework Core includes significant updates to the database provider for Azure Cosmos DB for NoSQL. It also includes some steps towards AOT compilation and pre-compiled queries, among other improvements. For more information, see What's New in EF Core 9.

C# 13

C# 13 ships with the .NET 9 SDK and includes the following new features:

  • params collections
  • New lock type and semantics
  • New escape sequence - \e
  • Method group natural type improvements
  • Implicit indexer access in object initializers

For more information, see What's new in C# 13.

Windows Presentation Foundation

Windows Presentation Foundation (WPF) includes support for Windows 11 theming and hyphen-based ligatures. For more information, see WPF in .NET 9 Preview 4 - Release Notes.

See also