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.

Garbage collection includes a dynamic adaptation to application size feature that's used by default instead of Server GC.

The runtime also includes numerous performance improvements, including loop optimizations, inlining, and Arm64 vectorization and code generation.

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

.NET libraries

System.Text.Json adds support for nullable reference type annotations and exporting JSON schemas from types. It adds new options that let you customize the indentation of written JSON and read multiple root-level JSON values from a single stream.

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 introduces workload sets, where all of your workloads stay at a single, specific version until explicitly updated. 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. In addition:

  • Unit testing has better MSBuild integration that allows you to run tests in parallel.
  • NuGet security audits run on both direct and transitive package references, by default.
  • The terminal logger is 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.
  • New MSBuild script analyzers ("build checks") are available.
  • The SDK can detect and adjust for version mismatches between the .NET SDK and MSBuild.
  • The dotnet workload history command shows you the history of workload installations and modifications for the current .NET SDK installation.

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
  • Enable ref locals and unsafe contexts in iterators and async methods
  • Enable ref struct types to implement interfaces
  • Allow ref struct types as arguments for type parameters in generics.
  • Partial properties and indexers are now allowed in partial types.
  • Overload resolution priority allows library authors to designate one overload as better than others.

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

F# 9

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

  • Nullable reference types
  • Discriminated union .Is* properties
  • Partial active patterns can return bool instead of unit option
  • Prefer extension methods to intrinsic properties when arguments are provided
  • Empty-bodied computation expressions
  • Hash directives are allowed to take non-string arguments
  • Extended #help directive in fsi to show documentation in the read-eval-print loop (REPL)
  • Allow #nowarn to support the FS prefix on error codes to disable warnings
  • Warning about TailCall attribute on non-recursive functions or let-bound values
  • Enforce attribute targets
  • Random functions for collections
  • C# collection expression support for F# lists and sets
  • Various developer productivity, performance and tooling improvements

For more information, see What's new in F# 9.

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