Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Analyze .NET test code for maintainability issues: duplicated boilerplate, copy-

### Step 1: Gather the test code

Read all test files the user provides or references. If the user points to a directory or project, scan for all test files — see the `exp-dotnet-test-frameworks` skill for framework-specific markers.
Read all test files the user provides or references. If the user points to a directory or project, scan for all test files — see the `dotnet-test-frameworks` skill for framework-specific markers.

### Step 2: Identify maintainability issues

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ description: >
Dockerfiles for .NET 11.
DO NOT USE FOR: .NET Framework migrations, upgrading from .NET 9 or earlier,
greenfield .NET 11 projects, or cosmetic modernization unrelated to the upgrade.
NOTE: .NET 11 is in preview. Covers breaking changes through Preview 1.
NOTE: .NET 11 is in preview. Covers breaking changes through Preview 3.
license: MIT
---

# .NET 10 → .NET 11 Migration

Migrate a .NET 10 project or solution to .NET 11, systematically resolving all breaking changes. The outcome is a project targeting `net11.0` that builds cleanly, passes tests, and accounts for every behavioral, source-incompatible, and binary-incompatible change introduced in .NET 11.

> **Note:** .NET 11 is currently in preview. This skill covers breaking changes documented through Preview 1. It will be updated as additional previews ship.
> **Note:** .NET 11 is currently in preview. This skill covers breaking changes documented through Preview 3.

## When to Use

Expand Down Expand Up @@ -59,10 +59,14 @@ Migrate a .NET 10 project or solution to .NET 11, systematically resolving all b
- **SDK attribute**: `Microsoft.NET.Sdk.Web` → ASP.NET Core; `Microsoft.NET.Sdk.WindowsDesktop` with `<UseWPF>` or `<UseWindowsForms>` → WPF/WinForms
- **PackageReferences**: `Microsoft.EntityFrameworkCore.*` → EF Core; `Microsoft.EntityFrameworkCore.Cosmos` → Cosmos DB provider
- **Dockerfile presence** → Container changes relevant
- **Cryptography API usage** → DSA on macOS affected
- **Cryptography API usage** → DSA on macOS affected; AIA cert download changes relevant
- **Compression API usage** → DeflateStream/GZipStream/ZipArchive changes relevant
- **TAR API usage** → Header checksum validation change relevant
- **TAR API usage** → Header checksum validation and HardLink entry changes relevant
- **`NamedPipeClientStream` usage with `SafePipeHandle`** → SYSLIB0063 constructor obsoletion relevant
- **`BackgroundService` usage** → Unhandled exceptions now stop the host
- **`Microsoft.OpenApi` direct usage** → v3 API breaking changes in ASP.NET Core OpenAPI
- **EF Core SQL Server with Entra ID auth** → SqlClient 7.0 auth dependency changes
- **NativeAOT native libraries on Unix** → Output filename prefix changed
4. Record which reference documents are relevant (see the reference loading table in Step 3).
5. Do a **clean build** (`dotnet build --no-incremental` or delete `bin`/`obj`) on the current `net10.0` target to establish a clean baseline. Record any pre-existing warnings.

Expand Down Expand Up @@ -93,9 +97,10 @@ Load reference documents based on the project's technology areas:
| `references/csharp-compiler-dotnet10to11.md` | Always (C# 15 compiler breaking changes) |
| `references/core-libraries-dotnet10to11.md` | Always (applies to all .NET 11 projects) |
| `references/sdk-msbuild-dotnet10to11.md` | Always (SDK and build tooling changes) |
| `references/efcore-dotnet10to11.md` | Project uses Entity Framework Core (especially Cosmos DB provider) |
| `references/cryptography-dotnet10to11.md` | Project uses cryptography APIs or targets macOS |
| `references/runtime-jit-dotnet10to11.md` | Deploying to older hardware or embedded devices |
| `references/aspnetcore-dotnet10to11.md` | Project uses ASP.NET Core (OpenAPI, Blazor) |
| `references/efcore-dotnet10to11.md` | Project uses Entity Framework Core |
| `references/cryptography-dotnet10to11.md` | Project uses cryptography APIs, mTLS, or targets macOS |
| `references/runtime-jit-dotnet10to11.md` | Deploying to older hardware, embedded devices, or using NativeAOT |

Work through each build error systematically. Common patterns:

Expand All @@ -115,6 +120,12 @@ Work through each build error systematically. Common patterns:

8. **`when` switch-expression-arm parsing** — `(X.Y) when` is now parsed as a constant pattern with a `when` clause instead of a cast expression, which can cause existing code to fail to compile or change meaning. Review switch expressions using `when` and adjust syntax as needed.

9. **Microsoft.OpenApi v3 breaking changes** — `Microsoft.AspNetCore.OpenApi` now depends on `Microsoft.OpenApi` 3.x. Code using `Microsoft.OpenApi` types directly (`OpenApiDocument`, `OpenApiSchema`, etc.) will have compile errors. Follow the v3 upgrade guide.

10. **EF Core Design package no longer transitive** — `Microsoft.EntityFrameworkCore.Tools` and `.Tasks` no longer depend on `.Design`. Add an explicit `PackageReference` if needed.

11. **EFOptimizeContext MSBuild property removed** — Replace with `<EFScaffoldModelStage>` and `<EFPrecompileQueriesStage>`.

### Step 4: Address behavioral changes

These changes compile successfully but alter runtime behavior. Review each one and determine impact:
Expand All @@ -137,6 +148,24 @@ These changes compile successfully but alter runtime behavior. Review each one a

9. **Mono launch target for .NET Framework** — No longer set automatically. If using Mono for .NET Framework apps on Linux, specify explicitly.

10. **Unhandled BackgroundService exceptions stop the host** — Exceptions from `ExecuteAsync()` now propagate and crash the host. Add try/catch in background services that should not bring down the application.

11. **ZipArchive CRC32 validation** — ZIP reads now validate CRC32 checksums. Corrupt or truncated archives that previously succeeded will now throw `InvalidDataException`.

12. **TarWriter emits HardLink entries** — Hard-linked files are now written as `HardLink` entries instead of duplicated data. Consumers of .NET-produced tar archives must handle `HardLink` entries.

13. **AIA certificate downloads disabled** — Server-side client-certificate validation no longer downloads intermediate CAs via AIA by default. Pre-install the full chain or have clients send intermediates.

14. **Blazor Virtualize OverscanCount default changed** — Default `OverscanCount` changed from 3 to 15. Set explicitly if performance-sensitive.

15. **Microsoft.Data.SqlClient 7.0 — Entra ID auth separated** — Azure/Entra ID authentication dependencies removed from the core SqlClient package. Add `Microsoft.Data.SqlClient.Extensions.Azure` if using Entra ID auth.

16. **SqlVector&lt;T&gt; excluded from SELECT** — Vector properties are no longer auto-loaded. Use explicit projections to include vector values.

17. **SQLitePCLRaw encryption bundles removed** — `bundle_e_sqlcipher` and other encryption bundle packages removed in SQLitePCLRaw 3.0.

18. **NativeAOT Unix native library `lib` prefix** — Output filenames now include `lib` prefix on Linux/macOS (e.g., `libMyLib.so`).

### Step 5: Update infrastructure

1. **Dockerfiles**: Update base images from 10.0 to 11.0:
Expand All @@ -155,7 +184,7 @@ These changes compile successfully but alter runtime behavior. Review each one a
"sdk": {
- "version": "10.0.100",
- "rollForward": "latestFeature"
+ "version": "11.0.100-preview.1",
+ "version": "11.0.100-preview.3",
+ "rollForward": "latestFeature"
},
"otherSettings": {
Expand All @@ -173,11 +202,15 @@ These changes compile successfully but alter runtime behavior. Review each one a
3. If the application is containerized, build and test the container image
4. Smoke-test the application, paying special attention to:
- Compression behavior with empty streams
- TAR file reading
- TAR file reading (checksum validation and HardLink entries)
- EF Core Cosmos DB operations (must be async)
- DSA usage on macOS
- Memory-intensive MemoryStream usage
- Span collection expression assignments
- BackgroundService exception handling
- mTLS / client certificate chain validation
- EF Core SQL Server with Entra ID authentication
- NativeAOT output filenames on Unix
5. Review the diff and ensure no unintended behavioral changes were introduced

## Reference Documents
Expand All @@ -189,6 +222,7 @@ The `references/` folder contains detailed breaking change information organized
| `references/csharp-compiler-dotnet10to11.md` | Always (C# 15 compiler breaking changes) |
| `references/core-libraries-dotnet10to11.md` | Always (applies to all .NET 11 projects) |
| `references/sdk-msbuild-dotnet10to11.md` | Always (SDK and build tooling changes) |
| `references/efcore-dotnet10to11.md` | Project uses Entity Framework Core (especially Cosmos DB provider) |
| `references/cryptography-dotnet10to11.md` | Project uses cryptography APIs or targets macOS |
| `references/runtime-jit-dotnet10to11.md` | Deploying to older hardware or embedded devices |
| `references/aspnetcore-dotnet10to11.md` | Project uses ASP.NET Core (OpenAPI, Blazor) |
| `references/efcore-dotnet10to11.md` | Project uses Entity Framework Core |
| `references/cryptography-dotnet10to11.md` | Project uses cryptography APIs, mTLS, or targets macOS |
| `references/runtime-jit-dotnet10to11.md` | Deploying to older hardware, embedded devices, or using NativeAOT |
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ASP.NET Core Breaking Changes (.NET 11)

These breaking changes affect ASP.NET Core projects. Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/11

> **Note:** .NET 11 is in preview. Additional ASP.NET Core breaking changes are expected in later previews.

## Source-Incompatible Changes

### Microsoft.OpenApi updated to v3 with OpenAPI 3.2.0 support (Preview 2)

**Impact: Medium.** `Microsoft.AspNetCore.OpenApi` updated its dependency from `Microsoft.OpenApi` 2.x to 3.x, adding OpenAPI 3.2.0 document generation. The underlying `Microsoft.OpenApi` library has breaking API changes in the v2→v3 transition.

Code that directly uses `Microsoft.OpenApi` types (`OpenApiDocument`, `OpenApiSchema`, `OpenApiOperation`, etc.) will have compile errors.

**Fix:** Follow the [Microsoft.OpenApi v3 upgrade guide](https://github.com/microsoft/OpenAPI.NET/blob/main/docs/upgrade-guide-3.md). If you only use the ASP.NET Core OpenAPI integration (`.WithOpenApi()`, `MapOpenApi()`) without touching the object model directly, no changes are needed.

Source: https://github.com/dotnet/aspnetcore/pull/65415

## Behavioral Changes

### Blazor Virtualize&lt;T&gt; default OverscanCount changed from 3 to 15 (Preview 3)

**Impact: Low.** The default `OverscanCount` on the `Virtualize<TItem>` component changed from `3` to `15` to support variable-height item measurement. `QuickGrid` retains its own default of `3`.

**Fix:** If performance-sensitive, set `OverscanCount` explicitly: `<Virtualize OverscanCount="3" />`.

Source: https://github.com/dotnet/aspnetcore/pull/64964
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,57 @@ Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-librari
**Impact: Low.** The minimum supported date for the Japanese Calendar has been corrected. Code using very early dates in the Japanese Calendar may be affected.

Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/globalization/11/japanese-calendar-min-date

### ZipArchive now validates CRC32 when reading entries (Preview 3)

**Impact: Low–Medium.** ZIP archive reads now validate the CRC32 checksum of each entry. Previously, corrupt or truncated archives were silently accepted; they now throw `InvalidDataException`.

**Fix:** Ensure ZIP files are not corrupted. If processing partially-written or legacy archives, add error handling for `InvalidDataException`.

Source: https://github.com/dotnet/runtime/pull/124766

### Unhandled BackgroundService exceptions now stop the host (Preview 3)

**Impact: Medium.** Unhandled exceptions thrown from `BackgroundService.ExecuteAsync()` now propagate and stop the host application. Previously they were silently swallowed.

```csharp
// .NET 10: exception silently swallowed, host continues
// .NET 11: exception propagates, host stops
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
throw new InvalidOperationException("oops"); // now kills the host
}

// FIX: Add proper exception handling
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
try
{
// ... work ...
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
_logger.LogError(ex, "Background service failed");
}
}
```

**Fix:** Add try/catch in `ExecuteAsync()` for any `BackgroundService` that should not crash the host on failure.

Source: https://github.com/dotnet/runtime/pull/124863

### TarWriter emits HardLink entries for hard-linked files (Preview 3)

**Impact: Low.** When `TarWriter` archives a directory containing hard links, the same inode encountered more than once is now written as a `HardLink` entry pointing back to the first occurrence, rather than duplicating the file data.

**Fix:** If consuming tar archives produced by .NET code, ensure the reader handles `HardLink` entry types.

Source: https://github.com/dotnet/runtime/pull/123874

### Zstandard APIs moved from preview package to System.IO.Compression (Preview 3)

**Impact: Low.** `ZstandardStream` and related APIs that were previously in the `System.IO.Compression.Zstandard` preview NuGet package are now in-box in `System.IO.Compression`.

**Fix:** Remove the `<PackageReference Include="System.IO.Compression.Zstandard" />` preview package if present. The APIs are now available without any additional package reference.

Source: https://github.com/dotnet/runtime/pull/114545
Loading
Loading