Skip to content
42 changes: 39 additions & 3 deletions docs/core/whats-new/dotnet-10/libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
title: What's new in .NET libraries for .NET 10
description: Learn about the updates to the .NET libraries for .NET 10.
titleSuffix: ""
ms.date: 06/09/2025
ms.date: 07/16/2025
ms.topic: whats-new
ai-usage: ai-assisted
---

# What's new in .NET libraries for .NET 10

This article describes new features in the .NET libraries for .NET 10. It's updated for Preview 5.
This article describes new features in the .NET libraries for .NET 10.

## Cryptography

Expand Down Expand Up @@ -95,7 +95,7 @@ using (MLKem key = MLKem.GenerateKey(MLKemAlgorithm.MLKem768))

These algorithms all continue with the pattern of having a static `IsSupported` property to indicate if the algorithm is supported on the current system.

Currently, the PQC algorithms are only available on systems where the system cryptographic libraries are OpenSSL 3.5 (or newer). Windows CNG support will be added soon. Also, the new classes are all marked as [`[Experimental]`](../../../fundamentals/syslib-diagnostics/experimental-overview.md) under diagnostic `SYSLIB5006` until development is complete.
.NET 10 includes Windows CNG support for post-quantum cryptography, making these algorithms available on Windows systems with PQC support. The PQC algorithms are available on systems where the system cryptographic libraries are OpenSSL 3.5 (or newer) or Windows CNG with PQC support. Also, the new classes are all marked as [`[Experimental]`](../../../fundamentals/syslib-diagnostics/experimental-overview.md) under diagnostic `SYSLIB5006` until development is complete.

## Globalization and date/time

Expand Down Expand Up @@ -165,13 +165,49 @@ This new API is already used in <xref:System.Json.JsonObject> and improves the p
## Serialization

- [Allow specifying ReferenceHandler in `JsonSourceGenerationOptions`](#allow-specifying-referencehandler-in-jsonsourcegenerationoptions)
- [Option to disallow duplicate JSON properties](#option-to-disallow-duplicate-json-properties)
- [Strict JSON serialization options](#strict-json-serialization-options)

### Allow specifying ReferenceHandler in `JsonSourceGenerationOptions`

When you use [source generators for JSON serialization](../../../standard/serialization/system-text-json/source-generation.md), the generated context throws when cycles are serialized or deserialized. Now you can customize this behavior by specifying the <xref:System.Text.Json.Serialization.ReferenceHandler> in the <xref:System.Text.Json.Serialization.JsonSourceGenerationOptionsAttribute>. Here's an example using `JsonKnownReferenceHandler.Preserve`:

:::code language="csharp" source="../snippets/dotnet-10/csharp/snippets.cs" id="snippet_selfReference":::

### Option to disallow duplicate JSON properties

The JSON specification doesn't specify how to handle duplicate properties when deserializing a JSON payload. This can lead to unexpected results and security vulnerabilities. .NET 10 introduces the `AllowDuplicateProperties` option to disallow duplicate JSON properties:

```csharp
string json = """{ "Value": 1, "Value": -1 }""";
Console.WriteLine(JsonSerializer.Deserialize<MyRecord>(json).Value); // -1

JsonSerializerOptions options = new() { AllowDuplicateProperties = false };
JsonSerializer.Deserialize<MyRecord>(json, options); // throws JsonException
JsonSerializer.Deserialize<JsonObject>(json, options); // throws JsonException
JsonSerializer.Deserialize<Dictionary<string, int>>(json, options); // throws JsonException

JsonDocumentOptions docOptions = new() { AllowDuplicateProperties = false };
JsonDocument.Parse(json, docOptions); // throws JsonException

record MyRecord(int Value);
```

Duplicate detection works by checking if a value is assigned multiple times during deserialization, so it works as expected with other options like case-sensitivity and naming policy.

### Strict JSON serialization options

The JSON serializer accepts many options to customize serialization and deserialization, but the defaults may be too relaxed for some applications. .NET 10 adds a new `JsonSerializationOptions.Strict` preset that follows best practices by including the following options:

- Applies the `JsonUnmappedMemberHandling.Disallow` policy
- Disables `AllowDuplicateProperties`
- Preserves case sensitive property binding
- Enables both `RespectNullableAnnotations` and `RespectRequiredConstructorParameters` settings

These options are read-compatible with `JsonSerializationOptions.Default` - an object serialized with `JsonSerializationOptions.Default` can be deserialized with `JsonSerializationOptions.Strict`.

For more information about JSON serialization, see [System.Text.Json overview](/dotnet/standard/serialization/system-text-json/overview).

## System.Numerics

- [More left-handed matrix transformation methods](#more-left-handed-matrix-transformation-methods)
Expand Down
20 changes: 12 additions & 8 deletions docs/core/whats-new/dotnet-10/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,48 @@
title: What's new in .NET 10
description: Learn about the new features introduced in .NET 10 for the runtime, libraries, and SDK. Also find links to what's new in other areas, such as ASP.NET Core.
titleSuffix: ""
ms.date: 06/09/2025
ms.date: 07/16/2025
ms.topic: whats-new
ai-usage: ai-assisted
---

# What's new in .NET 10

Learn about the new features in .NET 10 and find links to further documentation. This page is updated for Preview 5.
Learn about the new features in .NET 10 and find links to further documentation.

.NET 10, the successor to [.NET 9](../dotnet-9/overview.md), is [supported for three years](https://dotnet.microsoft.com/platform/support/policy/dotnet-core) as a long-term support (LTS) release. You can [download .NET 10 here](https://get.dot.net/10).

Your feedback is important and appreciated. If you have questions or comments, use the discussion on [GitHub](https://github.com/dotnet/core/discussions/categories/news).

## .NET runtime

The .NET 10 runtime introduces improvements in JIT inlining, method devirtualization, and stack allocations. It also includes AVX10.2 support and NativeAOT enhancements.
The .NET 10 runtime introduces improvements in JIT inlining, method devirtualization, and stack allocations. It also includes AVX10.2 support, NativeAOT enhancements, improved code generation for struct arguments, and enhanced loop inversion for better optimization.

For more information, see [What's new in the .NET 10 runtime](runtime.md).

## .NET libraries

The .NET 10 libraries introduce new APIs in cryptography, globalization, numerics, serialization, collections, and diagnostics, and when working with ZIP files.
The .NET 10 libraries introduce new APIs in cryptography, globalization, numerics, serialization, collections, and diagnostics, and when working with ZIP files. New JSON serialization options include disallowing duplicate properties and strict serialization settings. Post-quantum cryptography support has been expanded with Windows CNG support.

For more information, see [What's new in the .NET 10 libraries](libraries.md).

For details on JSON serialization, see [System.Text.Json overview](/dotnet/standard/serialization/system-text-json/overview).

## .NET SDK

The .NET 10 SDK includes support for Microsoft.Testing.Platform in `dotnet test`, standardizes CLI command order, and updates the CLI to generate native tab-completion scripts for popular shells. For containers, console apps can natively create container images, and a new property lets you explicitly set the format of container images.
The .NET 10 SDK includes support for Microsoft.Testing.Platform in `dotnet test`, standardizes CLI command order, and updates the CLI to generate native tab-completion scripts for popular shells. For containers, console apps can natively create container images, and a new property lets you explicitly set the format of container images. The SDK also supports platform-specific .NET tools, one-shot tool execution with `dotnet tool exec`, the new `dnx` tool execution script, CLI introspection with `--cli-schema`, and enhanced file-based apps with publish support and native AOT.

For more information, see [What's new in the SDK for .NET 10](sdk.md).

For details on .NET tools, see [Manage .NET tools](/dotnet/core/tools/global-tools).

## .NET Aspire

For information about what's new in .NET Aspire, see [.NET Aspire — what's new?](/dotnet/aspire/whats-new/).

## ASP.NET Core

The ASP.NET Core 10.0 release introduces several new features and enhancements, including Blazor improvements, OpenAPI enhancements, and minimal API updates.
The ASP.NET Core 10.0 release introduces several new features and enhancements, including Blazor improvements, OpenAPI enhancements, and minimal API updates. Features include Blazor WebAssembly preloading, automatic memory pool eviction, enhanced form validation, improved diagnostics, and passkey support for Identity.

For details, see [What's new in ASP.NET Core for .NET 10](/aspnet/core/release-notes/aspnetcore-10.0).

Expand Down Expand Up @@ -88,13 +92,13 @@ These updates ensure that Visual Basic can consume updated features in C# and th

## .NET MAUI

The .NET MAUI updates in .NET 10 include several new features and quality improvements for .NET MAUI, .NET for Android, and .NET for iOS, Mac Catalyst, macOS, and tvOS.
The .NET MAUI updates in .NET 10 include several new features and quality improvements for .NET MAUI, .NET for Android, and .NET for iOS, Mac Catalyst, macOS, and tvOS. Features include MediaPicker enhancements for selecting multiple files and image compression, WebView request interception, and support for Android API levels 35 and 36.

For details, see [What's new in .NET MAUI in .NET 10](/dotnet/maui/whats-new/dotnet-10).

## EF Core

The EF Core 10 release introduces several new features and improvements, including LINQ enhancements, performance optimizations, and improved support for Azure Cosmos DB.
The EF Core 10 release introduces several new features and improvements, including LINQ enhancements, performance optimizations, improved support for Azure Cosmos DB, and named query filters that allow multiple filters per entity type with selective disabling.

For details, see [What's new in EF Core for .NET 10](/ef/core/what-is-new/ef-core-10.0/whatsnew).

Expand Down
22 changes: 20 additions & 2 deletions docs/core/whats-new/dotnet-10/runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,31 @@
title: What's new in .NET 10 runtime
description: Learn about the new features introduced in the .NET 10 runtime.
titleSuffix: ""
ms.date: 06/09/2025
ms.date: 07/16/2025
ms.topic: whats-new
ai-usage: ai-assisted
---
# What's new in the .NET 10 runtime

This article describes new features and performance improvements in the .NET runtime for .NET 10. It's updated for Preview 5.
This article describes new features and performance improvements in the .NET runtime for .NET 10.

## JIT compiler improvements

The JIT compiler in .NET 10 includes significant enhancements that improve performance through better code generation and optimization strategies.

### Improved code generation for struct arguments

.NET's JIT compiler is capable of an optimization called physical promotion, where the members of a struct are placed in registers rather than on the stack, eliminating memory accesses. This optimization is particularly useful when passing a struct to a method, and the calling convention requires the struct members to be passed in registers.

.NET 10 improves the JIT compiler's internal representation to handle values that share a register. Previously, when struct members needed to be packed into a single register, the JIT would store values to memory first and then load them into a register. Now, the JIT compiler can place the promoted members of struct arguments into shared registers directly, eliminating unnecessary memory operations.

For example, consider a struct with two `int` members. On x64, since `int` values are four bytes wide and registers are eight bytes wide, both members can be packed into one register. The improved code generation eliminates the need for intermediate memory storage, resulting in more efficient assembly code.

### Improved loop inversion

The JIT compiler can hoist the condition of a `while` loop and transform the loop body into a `do-while` loop, improving code layout by removing the need to branch to the top of the loop to test the condition. This transformation is called loop inversion, and it enables numerous other optimizations like loop cloning, loop unrolling, and induction variable optimizations.

.NET 10 enhances loop inversion by switching from a lexical analysis implementation to a graph-based loop recognition implementation. This change brings improved precision by considering all natural loops (loops with a single entry point) and ignoring false positives that were previously considered. This translates into higher optimization potential for .NET programs with `for` and `while` statements.

## Array interface method devirtualization

Expand Down
72 changes: 70 additions & 2 deletions docs/core/whats-new/dotnet-10/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,82 @@
title: What's new in the SDK and tooling for .NET 10
description: Learn about the new .NET SDK features introduced in .NET 10.
titleSuffix: ""
ms.date: 06/09/2025
ms.date: 07/16/2025
ms.topic: whats-new
ai-usage: ai-assisted
---

# What's new in the SDK and tooling for .NET 10

This article describes new features and enhancements in the .NET SDK for .NET 10. It's updated for Preview 5.
This article describes new features and enhancements in the .NET SDK for .NET 10.

## .NET tools enhancements

### Platform-specific .NET tools

.NET tools can now be published with support for multiple RuntimeIdentifiers (RIDs) in a single package. Tool authors can bundle binaries for all supported platforms, and the .NET CLI will select the correct one at install or run time. This makes cross-platform tool authoring and distribution much easier.

These enhanced tools support various packaging variations:

- **Framework-dependent, platform-agnostic** (classic mode, runs anywhere with .NET 10 installed)
- **Framework-dependent, platform-specific** (smaller, optimized for each platform)
- **Self-contained, platform-specific** (includes the runtime, no .NET installation required)
- **Trimmed, platform-specific** (smaller, trims unused code)
- **AOT-compiled, platform-specific** (maximum performance and smallest deployment)

These new tools work much like normal published applications, so any publishing options you can use with applications (self-contained, trimmed, AOT, etc.) can apply to tools as well.

### One-shot tool execution

You can now use the `dotnet tool exec` command to execute a .NET tool without installing it globally or locally. This is especially valuable for CI/CD or ephemeral usage.

```bash
dotnet tool exec --source ./artifacts/package/ toolsay "Hello, World!"
```

This downloads and runs the specified tool package in one command. By default, users are prompted to confirm the download if the tool doesn't already exist locally. The latest version of the chosen tool package is used unless an explicit version is specified.

One-shot tool execution works seamlessly with local tool manifests. If you run a tool from a location containing a `.config/dotnet-tools.json` nearby, the version of the tool in that configuration will be used instead of the latest version available.

### The new `dnx` tool execution script

The `dnx` script provides a streamlined way to execute tools. It forwards all arguments to the `dotnet` CLI for processing, making tool usage as simple as possible:

```bash
dnx toolsay "Hello, World!"
```

The actual implementation of the `dnx` command is in the `dotnet` CLI itself, allowing its behavior to evolve over time.

For more information about managing .NET tools, see [Manage .NET tools](/dotnet/core/tools/global-tools).

### CLI introspection with `--cli-schema`

A new `--cli-schema` option is available on all CLI commands. When used, it outputs a JSON representation of the CLI command tree for the invoked command or subcommand. This is useful for tool authors, shell integration, and advanced scripting.

```bash
dotnet clean --cli-schema
```

The output provides a structured, machine-readable description of the command's arguments, options, and subcommands.

## File-based apps enhancements

.NET 10 brings significant updates to the file-based apps experience, including publish support and native AOT capabilities. For an introduction to file-based programs, see [File based programs](/dotnet/csharp/tour-of-csharp/overview#file-based-programs) and [Building and running C# programs](/dotnet/csharp/fundamentals/program-structure/index#building-and-running-c-programs).

### Enhanced file-based apps with publish support and native AOT

File-based apps now support being published to native executables via the `dotnet publish app.cs` command, making it easier to create simple apps that you can redistribute as native executables. All file-based apps now target native AOT by default. If you need to use packages or features that are incompatible with native AOT, you can disable this using the `#:property PublishAot=false` directive in your .cs file.

File-based apps also include enhanced features:

- **Project referencing**: Support for referencing projects via the `#:project` directive
- **Runtime path access**: App file and directory paths are available at runtime via `System.AppContext.GetData`
- **Enhanced shebang support**: Direct shell execution with improved shebang handling, including support for extensionless files

These enhancements make file-based apps more powerful while maintaining their simplicity for quick scripting and prototyping scenarios.

For more information about native AOT, see [.NET native AOT](/dotnet/core/deploying/native-aot/).

## Pruning of framework-provided package references

Expand Down