.NET 11 // C# 15 & CRAFTSMANSHIP
.NET 11 et C# 15 : le compilateur connaît enfin tous vos cas
Unions, hiérarchies fermées, runtime async et breaking changes : ce que .NET 11 change vraiment dans votre code, avant/après à l'appui et sources Microsoft vérifiées.
Mis à jour le 19 novembre 2026 : .NET 11 est officiellement disponible (GA) depuis le 10 novembre 2026 (SDK
11.0.100, support STS de 2 ans jusqu'au 14 novembre 2028). Les affirmations sur .NET et C# viennent de la documentation officielle Microsoft, les autres sources sont citées en lien.
💥 Acte 1 : Le default inutile
Vous connaissez ce code. Un statut de paiement verrouillé dans les
règles de l'art : constructeur private, sous-types sealed,
tous déclarés au même endroit. Et pourtant, le switch exige un dernier
cas.
public abstract record PaymentStatus
{
private PaymentStatus() { }
public sealed record Pending : PaymentStatus;
public sealed record Completed : PaymentStatus;
public sealed record Failed : PaymentStatus;
}
string Label(PaymentStatus status) => status switch
{
PaymentStatus.Pending => "En attente",
PaymentStatus.Completed => "Terminé",
PaymentStatus.Failed => "Échec",
_ => throw new UnreachableException()
};
Un cas default inutile. Il ne sera jamais atteint,
mais le compilateur ne sait pas déduire une hiérarchie fermée d'un constructeur
privé : sans ce cas, il lève CS8509. La
proposition C# 15
le reconnaît : le langage n'offrait aucun moyen d'exprimer cette intention.
Inutile, jusqu'au jour où il devient dangereux. Quelqu'un ajoute
Refunded. Build vert, tests verts, aucun avertissement : le
default avale l'oubli, et le premier remboursement lève une exception «
inatteignable » en production.
C# 15, livré avec .NET 11, donne enfin au compilateur cette connaissance. C'est le fil rouge de cette version : rendre explicite ce que nous gardions dans nos têtes, et laisser l'outillage le vérifier.
🩸 Acte 2 : Le coût caché de ce que le compilateur ignore
Chaque cas default est une dette. Il désactive le seul
relecteur qui ne se fatigue jamais : l'analyse d'exhaustivité. Le bug passe du poste
du développeur au téléphone d'astreinte.
Le runtime a ses propres silences. Jusqu'à .NET 10, un
BackgroundService qui crashe arrêtait l'hôte sans faire échouer
RunAsync :
public sealed class InvoiceWorker : BackgroundService
{
protected override Task ExecuteAsync(CancellationToken stoppingToken)
=> throw new InvalidOperationException("Base de factures injoignable");
}
await host.RunAsync();
// .NET 10 : l'hôte s'arrête, la tâche réussit → le plus souvent exit code 0
// .NET 11 : RunAsync relance l'exception → le processus sort en échec
Votre orchestrateur voyait un succès. Vous voyiez un service mort. .NET 11 s'attaque précisément à ces angles morts.
🏗️ Acte 3 : Les nouveautés qui comptent, avant/après
🔒 Hiérarchies fermées : closed
Le pourquoi : un type closed ne peut être dérivé
directement que dans son propre assembly. Le compilateur connaît donc tous les cas.
public closed record class PaymentStatus;
public record Pending : PaymentStatus;
public record Completed : PaymentStatus;
public record Failed : PaymentStatus;
string Label(PaymentStatus status) => status switch
{
Pending => "En attente",
Completed => "Terminé",
Failed => "Échec",
};
L'avantage : plus de cas default. Ajoutez
Refunded et chaque switch incomplet lève
CS8509 là où la décision métier manque : c'est le shift left dans sa
forme la plus pure, un feedback immédiat sur le poste du développeur.
À savoir : un type closed est implicitement
abstract, la fermeture n'est pas transitive, et un
switch sur PaymentStatus? doit aussi traiter
null (référence).
🧬 Union types : union
Le pourquoi : une union est un type dont chaque valeur est
exactement un des types qu'elle énumère. Là où closed ferme
une hiérarchie que vous possédez, l'union assemble des types sans ancêtre commun. Un
refus bancaire n'est pas une exception, c'est une issue métier :
// Avant : la signature ment, les issues métier passent par des exceptions
Receipt Charge(Order order); // lève PaymentDeclinedException, GatewayTimeoutException
// Après : chaque issue est une valeur typée
public union PaymentResult(Receipt, Declined, GatewayTimeout);
PaymentResult Charge(Order order)
{
if (order.Total > order.Customer.CreditLimit)
{
return new Declined("Plafond dépassé");
}
return new Receipt(Guid.NewGuid().ToString(), order.Total);
}
string Describe(PaymentResult result) => result switch
{
Receipt receipt => $"Paiement {receipt.TransactionId} accepté",
Declined declined => $"Refusé : {declined.Reason}",
GatewayTimeout timeout => $"Banque muette après {timeout.After.TotalSeconds} s",
};
L'avantage : la signature dit enfin la vérité, et le compilateur
garantit que chaque issue est traitée. C'est le type Result de F# ou de
Rust : un pas net vers la programmation fonctionnelle, avec un code qui se lit de
haut en bas. System.Text.Json sérialise directement le cas actif.
À savoir : C# rattrape TypeScript (Receipt | Declined), à une différence près : l'union se déclare et se nomme. À mes yeux, c'est la
nouveauté la plus attendue, réclamée depuis des années — et désormais disponible en
C# 15. Commencez par les types de retour de vos cas d'usage et vos contrats d'API.
📦 Arguments de collection expression : with(...)
Le pourquoi : les collection expressions de C# 12 ne savaient pas
passer de capacité ni de comparer : un seul paramètre de constructeur vous renvoyait
vers l'ancien new ... { }.
// Avant
var tags = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "DDD", "ddd", "TDD" };
// Après
HashSet<string> tags = [with(StringComparer.OrdinalIgnoreCase), "DDD", "ddd", "TDD"];
List<string> names = [with(capacity: values.Length * 2), .. values];
L'avantage : toute l'initialisation tient dans la syntaxe
[...], un format unique et homogène dans la codebase, qui se rapproche
des littéraux de tableau de TypeScript.
🔁 break et continue labellisés
Le pourquoi : sortir de deux boucles imbriquées exigeait un booléen de contrôle, positionné dans la boucle interne et vérifié dans la boucle externe.
// Avant
var goalReached = false;
for (var row = 0; row < grid.Height && !goalReached; row++)
{
for (var column = 0; column < grid.Width; column++)
{
if (grid[row, column].IsGoal)
{
goalReached = true;
break;
}
}
}
// Après
outer: for (var row = 0; row < grid.Height; row++)
{
for (var column = 0; column < grid.Width; column++)
{
if (grid[row, column].IsGoal)
{
break outer;
}
}
}
L'avantage : l'intention est écrite dans l'instruction elle-même, sans variable d'état. La règle IDE0410 signale les booléens remplaçables.
À savoir : deux boucles avec sortie anticipée sont souvent une
méthode qui ne s'est pas encore extraite ; un return bien nommé reste
souvent mieux.
⚙️ Runtime Async : des stack traces qui disent la vérité
Le pourquoi : depuis 2012, chaque méthode async est
réécrite en machine à états par le compilateur. .NET 11 confie ce travail au
runtime, et ses propres bibliothèques sont déjà compilées ainsi.
<!-- Une ligne dans le .csproj (net11.0) -->
<Features>runtime-async=on</Features>
Sans runtime-async : 13 frames
at Program.<<Main>$>g__InnerAsync|0_2() in Program.cs:line 24
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](...)
at Program.<<Main>$>g__InnerAsync|0_2()
at Program.<<Main>$>g__MiddleAsync|0_1() in Program.cs:line 14
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](...)
at Program.<<Main>$>g__MiddleAsync|0_1()
at Program.<<Main>$>g__OuterAsync|0_0() in Program.cs:line 8
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](...)
at Program.<<Main>$>g__OuterAsync|0_0()
at Program.<Main>$(String[] args) in Program.cs:line 3
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](...)
at Program.<Main>$(String[] args)
at Program.<Main>(String[] args)
Avec runtime-async : 5 frames
at Program.<<Main>$>g__InnerAsync|0_2() in Program.cs:line 24
at Program.<<Main>$>g__MiddleAsync|0_1() in Program.cs:line 14
at Program.<<Main>$>g__OuterAsync|0_0() in Program.cs:line 8
at Program.<Main>$(String[] args) in Program.cs:line 3
at Program.<Main>(String[] args)
L'avantage : profilers, APM et debuggers montrent vos méthodes, pas la machinerie du compilateur : un diagnostic plus rapide en incident. Le runtime réutilise aussi les objets de continuation, ce qui réduit les allocations, sans changer une ligne de code.
À savoir : la
fonctionnalité
reste opt-in pour votre code applicatif (sans avoir besoin de
EnablePreviewFeatures en net11.0), et les traces
d'exceptions étaient déjà propres. Activez-la sur un service, mesurez, puis
généralisez.
⚡ CLI NativeAOT & MSBuild Server par défaut
Le pourquoi : chaque commande dotnet démarrait
jusqu'ici un hôte managé et un processus MSBuild à froid. Le SDK .NET 11 compile
désormais le point d'entrée CLI en NativeAOT et garde un serveur MSBuild chaud entre
vos builds.
# Rien à changer : actif par défaut dès le SDK 11.0.100
dotnet --version # exécuté en natif, sans démarrer le runtime managé
dotnet build # réutilise un processus MSBuild déjà chaud
dotnet test # même boucle courte en développement local
# Opt-out si un outil ou script pose problème :
DOTNET_CLI_ENABLEAOT=false
DOTNET_CLI_USE_MSBUILD_SERVER=false
L'avantage : une boucle de feedback locale plus rapide sur toutes vos commandes quotidiennes, sans toucher une ligne de code ni de configuration.
🚀 Lancer un processus : une seule instruction
Le pourquoi : exécuter une commande et lire sa sortie imposait de
configurer un ProcessStartInfo, de lire le flux puis d'attendre la fin.
// Avant
var startInfo = new ProcessStartInfo("git", "status --porcelain")
{
RedirectStandardOutput = true,
UseShellExecute = false
};
using var process = Process.Start(startInfo)!;
var output = await process.StandardOutput.ReadToEndAsync();
await process.WaitForExitAsync();
// Après
ProcessTextOutput result = await Process.RunAndCaptureTextAsync("git", ["status", "--porcelain"]);
L'avantage : Process.RunAndCaptureTextAsync condense
ce rituel en une instruction. Sortie, erreurs et code de sortie reviennent dans un
seul résultat typé : moins de code d'infrastructure, et un code de sortie qu'on
n'oublie plus de vérifier.
🛡️ La quarantaine NuGet : --min-publish-age-hours
Le pourquoi : sans garde-fou, une version publiée il y a cinq minutes peut atterrir dans votre build. Le SDK .NET 11 impose un âge minimum : toute version plus jeune est ignorée à la sélection.
dotnet nuget update source nuget.org --min-publish-age-hours 72 --configfile nuget.config
L'avantage : les versions compromises sont souvent retirées en
quelques heures. En septembre 2025, les versions piégées de chalk et
debug sur npm ont été dépubliées dans la journée : un délai d'attente
les aurait tenues hors de vos builds.
Ma recommandation : 3 à 7 jours. Le temps que scanners et
mainteneurs éprouvent une version avant vos environnements de production. Côté
JavaScript, la pratique est établie :
Renovate
la propose depuis des années (3 jours pour npm dans
config:best-practices), pnpm depuis la 10.16. L'outillage .NET n'avait rien d'équivalent en natif.
🗂️ Les autres nouveautés en bref
Le pourquoi : des ajouts plus discrets, mais utiles au quotidien.
// Indexeur d'extension (dans une classe statique)
extension(IEnumerable<int> sequence) { public int this[int index] => sequence.ElementAt(index); }
// LINQ : jointure complète, tuples en retour
var rows = products.FullJoin(categories, product => product.Category, category => category.Name);
// Nouvelle surcharge à sélecteur de clé (la version à délégués date de .NET 8)
var byName = EqualityComparer<Person>.Create(person => person.Name);
// File-based app découpée en plusieurs fichiers
#:include helpers.cs
Et aussi : compression Zstandard (ZstandardStream),
OpenAPI 3.2 et validation asynchrone (ASP.NET Core / DataAnnotations),
composant Blazor CacheView, .NET MAUI sur CoreCLR par défaut, types
décimaux IEEE 754 (Decimal32, Decimal64,
Decimal128), X25519DiffieHellman et AES Key Wrap. La liste
complète est sur les pages officielles
.NET 11
et
C# 15.
🧨 Les breaking changes auxquels faire attention
La liste officielle est surtout comportementale : le code compile toujours, le résultat change. Seuls vos tests peuvent le voir. Trois familles comptent.
🔢 Des calculs plus justes, des résultats qui changent
Le pourquoi : arrondis, conversions et casts deviennent exacts et
déterministes. Microsoft estime à ~5 % les valeurs que l'ancien
Math.Round arrondissait mal.
Math.Round(655.925, 2, MidpointRounding.AwayFromZero);
// .NET 10 : 655.93 (faux : 655.925 est stocké 655.92499999...)
// .NET 11 : 655.92 (correctement arrondi)
decimal price = (decimal)1.23; // .NET 11 : 1.229999999999999982236431606
decimal fixedPrice = 1.23m; // le littéral fiable pour manipuler des montants monétaires
static short ToShort(double value) => unchecked((short)value);
ToShort(65578.0);
// .NET 10 : 42 en pratique sur CoreCLR, sans garantie
// .NET 11 : 32767 (saturation à la borne)
À faire : régénérer les snapshots de tests, vérifier les montants
persistés calculés en double, et auditer les casts qui servent d'index.
📣 Des échecs enfin visibles
Le pourquoi : mon breaking change préféré. Ce qui échouait en
silence échoue désormais fort : l'hôte générique (voir l'acte 2), les entrées ZIP
corrompues (contrôle CRC32, InvalidDataException) et les appels
invalides à DateOnly / TimeOnly.TryParse.
DateOnly.TryParse("2026-11-10", CultureInfo.InvariantCulture, (DateTimeStyles)999, out var date);
// .NET 10 : false, le bug de programmation passe inaperçu
// .NET 11 : ArgumentException, le bug saute aux yeux
À faire : corriger les appels fautifs et gérer
InvalidDataException sur les archives reçues de l'extérieur. Pour
l'hôte, rien : c'est le bon comportement.
🖥️ Plateforme et packaging
Le pourquoi : le processeur minimum passe à x86-64-v2 (SSE4.2,
POPCNT : les CPU plus anciens sont sortis du support vers 2013), NativeAOT ajoute le
préfixe lib sous Unix et saute la cible Build lors d'un
publish (BeforeBuild / AfterBuild ne
s'exécutent plus), et DSA disparaît de macOS.
# Sur un CPU sans SSE4.2 ni POPCNT, le runtime refuse de démarrer :
The current CPU is missing one or more of the baseline instruction sets.
# NativeAOT sous Unix
foo.so → libfoo.so
À faire : vérifier les vieux agents de build et VM émulées, adapter les scripts de packaging, et migrer DSA vers ECDSA ou RSA.
🤖 Acte 4 : Le harnais de migration
Une fonctionnalité n'est une garantie que si le build la rend
obligatoire.
closed sans erreur sur CS8509, c'est un avertissement de
plus dans une liste que personne ne lit.
<PropertyGroup>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<WarningsAsErrors>$(WarningsAsErrors);CS8509;CS8655</WarningsAsErrors>
</PropertyGroup>
+-------------------------------------------------------------------+
| HARNAIS DE MIGRATION VERS .NET 11 |
+-------------------------------------------------------------------+
| [global.json] SDK épinglé, montée proposée par Renovate |
| ▼ |
| [Multi-target] net10.0 + net11.0 : mêmes tests, deux runtimes |
| ▼ |
| [Tests de caractérisation] arrondis, casts, parsing, exit codes |
| ▼ |
| [WarningsAsErrors] CS8509 / CS8655 : exhaustivité obligatoire |
| ▼ |
| [NuGet] min-publish-age-hours : quarantaine supply chain |
+-------------------------------------------------------------------+
Les tests de caractérisation épinglent dès aujourd'hui vos
arrondis, conversions et parsings critiques : chaque divergence en
net11.0 devient un test rouge, pas un ticket de support. Et pour les
agents IA, un switch exhaustif est une contrainte qu'aucun
default de complaisance ne contourne.
⚖️ Acte 5 : Ce qui change au quotidien & conclusion
Le résumé en situations concrètes : ce que vous obtenez aujourd'hui, et ce que .NET 11 vous donne.
+---------------------------------+--------------------------------+-------------------------------+
| Situation | Avec .NET 10 / C# 14 | Avec .NET 11 / C# 15 |
+---------------------------------+--------------------------------+-------------------------------+
| Sous-type oublié dans un switch | Exception en production | Signalé au build (shift left) |
| Résultat « payé OU refusé » | Exception ou wrapper maison | union PaymentResult |
| Sortir de 2 boucles imbriquées | Booléen de contrôle | break outer |
| Stack trace dans un profiler | 13 frames, dont 8 techniques | 5 frames, toutes à vous |
| dotnet build / test en local | Hôte managé + MSBuild à froid | CLI NativeAOT + serveur chaud |
| Lancer git et lire sa sortie | ~8 lignes de configuration | 1 appel |
| Worker en échec | Code de sortie 0 (succès !) | Exception, code d'échec |
| Version publiée il y a 1 h | Choisie dès l'ajout du package | Écartée par la quarantaine |
+---------------------------------+--------------------------------+-------------------------------+
🧭 Faut-il migrer ? Oui, et à chaque version
Le pourquoi : depuis .NET 9, une version STS est supportée 24 mois : .NET 11 est supporté jusqu'au 14 novembre 2028, exactement la même date que .NET 10 LTS (tandis que .NET 8 LTS et .NET 9 ont cessé d'être supportés le 10 novembre 2026). Sauter les STS n'achète plus de stabilité, seulement un plus gros saut.
// global.json : la montée annuelle tient en une ligne, proposée par Renovate
{
"sdk": {
- "version": "10.0.100",
+ "version": "11.0.100", // SDK .NET 11 GA (10 novembre 2026)
"rollForward": "latestFeature"
}
}
L'avantage : une seule liste de breaking changes à lire, une PR relue dans la journée. Sauter deux versions transforme la montée en projet, et un projet se reporte. C'est la première loi de Lehman (1974) : un logiciel en usage doit être adapté en continu, sinon il devient de moins en moins satisfaisant.
Le fil rouge de .NET 11, c'est le feedback au plus tôt : exhaustivité vérifiée au build, issues métier portées par les types, échecs qui remontent au lieu d'être avalés. Le compilateur devient votre premier relecteur.
À vous : combien de _ => throw inutiles dorment
dans votre codebase, en attendant le prochain sous-type ?
Updated November 19, 2026: .NET 11 reached General Availability (GA) on November 10, 2026 (SDK
11.0.100, 2-year STS support until November 14, 2028). Claims about .NET and C# come from the official Microsoft documentation; other sources are linked inline.
💥 Act 1: The Useless default
You know this code. A payment status locked down by the book:
private constructor, sealed subtypes, all declared in one
place. And yet the switch demands one last case.
public abstract record PaymentStatus
{
private PaymentStatus() { }
public sealed record Pending : PaymentStatus;
public sealed record Completed : PaymentStatus;
public sealed record Failed : PaymentStatus;
}
string Label(PaymentStatus status) => status switch
{
PaymentStatus.Pending => "Pending",
PaymentStatus.Completed => "Completed",
PaymentStatus.Failed => "Failed",
_ => throw new UnreachableException()
};
A useless default case. It will never be reached, but
the compiler cannot infer a closed hierarchy from a private constructor: without
that case, it raises CS8509. The
C# 15 proposal
acknowledges it: the language offered no way to express that intent.
Useless, until the day it becomes dangerous. Someone adds
Refunded. Green build, green tests, no warning: the
default swallows the omission, and the first refund throws an
"unreachable" exception in production.
C# 15, shipping with .NET 11, finally gives the compiler that knowledge. That is the common thread of this release: make explicit what we used to keep in our heads, and let the tooling verify it.
🩸 Act 2: The Hidden Cost of What the Compiler Cannot See
Every default case is debt. It disables the only
reviewer that never gets tired: exhaustiveness analysis. The bug moves from the
developer's laptop to the on-call phone.
The runtime has its own silences. Up to .NET 10, a crashing
BackgroundService stopped the host without failing
RunAsync:
public sealed class InvoiceWorker : BackgroundService
{
protected override Task ExecuteAsync(CancellationToken stoppingToken)
=> throw new InvalidOperationException("Invoice database unreachable");
}
await host.RunAsync();
// .NET 10: the host stops, the task succeeds → usually exit code 0
// .NET 11: RunAsync rethrows → the process exits with a failure
Your orchestrator saw success. You saw a dead service. .NET 11 targets exactly these blind spots.
🏗️ Act 3: The Changes That Matter, Before/After
🔒 Closed Hierarchies: closed
The why: a closed type can only be directly derived
within its own assembly. The compiler therefore knows every case.
public closed record class PaymentStatus;
public record Pending : PaymentStatus;
public record Completed : PaymentStatus;
public record Failed : PaymentStatus;
string Label(PaymentStatus status) => status switch
{
Pending => "Pending",
Completed => "Completed",
Failed => "Failed",
};
The benefit: no more default case. Add
Refunded and every incomplete switch raises
CS8509 where the business decision is missing: shift left in its purest
form, immediate feedback on the developer's machine.
Good to know: a closed type is implicitly
abstract, closure is not transitive, and a switch on
PaymentStatus? must also handle null (reference).
🧬 Union Types: union
The why: a union is a type whose every value is
exactly one of the types it lists. Where closed seals a
hierarchy you own, a union combines types with no common ancestor. A bank refusal is
not an exception, it is a business outcome:
// Before: the signature lies, business outcomes travel as exceptions
Receipt Charge(Order order); // throws PaymentDeclinedException, GatewayTimeoutException
// After: every outcome is a typed value
public union PaymentResult(Receipt, Declined, GatewayTimeout);
PaymentResult Charge(Order order)
{
if (order.Total > order.Customer.CreditLimit)
{
return new Declined("Credit limit exceeded");
}
return new Receipt(Guid.NewGuid().ToString(), order.Total);
}
string Describe(PaymentResult result) => result switch
{
Receipt receipt => $"Payment {receipt.TransactionId} accepted",
Declined declined => $"Declined: {declined.Reason}",
GatewayTimeout timeout => $"Bank silent after {timeout.After.TotalSeconds} s",
};
The benefit: the signature finally tells the truth, and the
compiler guarantees every outcome is handled. It is the Result type of
F# or Rust: a clear step toward functional programming, with code that reads top to
bottom. System.Text.Json serializes the active case directly.
Good to know: C# catches up with TypeScript (Receipt | Declined), with one difference: a union is declared and named. In my view, it is the most
awaited feature, requested for years—and now generally available in
C# 15. Start with your use-case return types and API contracts.
📦 Collection Expression Arguments: with(...)
The why: C# 12 collection expressions could not pass a capacity or
a comparer: a single constructor parameter sent you back to the old
new ... { }.
// Before
var tags = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "DDD", "ddd", "TDD" };
// After
HashSet<string> tags = [with(StringComparer.OrdinalIgnoreCase), "DDD", "ddd", "TDD"];
List<string> names = [with(capacity: values.Length * 2), .. values];
The benefit: the whole initialization fits in the
[...] syntax, one consistent format across the codebase, closer to
TypeScript array literals.
🔁 Labeled break and continue
The why: escaping two nested loops required a Boolean control flag, set in the inner loop and checked in the outer one.
// Before
var goalReached = false;
for (var row = 0; row < grid.Height && !goalReached; row++)
{
for (var column = 0; column < grid.Width; column++)
{
if (grid[row, column].IsGoal)
{
goalReached = true;
break;
}
}
}
// After
outer: for (var row = 0; row < grid.Height; row++)
{
for (var column = 0; column < grid.Width; column++)
{
if (grid[row, column].IsGoal)
{
break outer;
}
}
}
The benefit: the intent is written in the statement itself, with no state variable. Rule IDE0410 flags the replaceable flags.
Good to know: two loops with an early exit are often a method that
has not been extracted yet; a well-named return is often still better.
⚙️ Runtime Async: Stack Traces That Tell the Truth
The why: since 2012, the compiler has rewritten every
async method into a state machine. .NET 11 hands that job to the
runtime, and its own libraries are already compiled that way.
<!-- One line in the .csproj (net11.0) -->
<Features>runtime-async=on</Features>
Without runtime-async: 13 frames
at Program.<<Main>$>g__InnerAsync|0_2() in Program.cs:line 24
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](...)
at Program.<<Main>$>g__InnerAsync|0_2()
at Program.<<Main>$>g__MiddleAsync|0_1() in Program.cs:line 14
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](...)
at Program.<<Main>$>g__MiddleAsync|0_1()
at Program.<<Main>$>g__OuterAsync|0_0() in Program.cs:line 8
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](...)
at Program.<<Main>$>g__OuterAsync|0_0()
at Program.<Main>$(String[] args) in Program.cs:line 3
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](...)
at Program.<Main>$(String[] args)
at Program.<Main>(String[] args)
With runtime-async: 5 frames
at Program.<<Main>$>g__InnerAsync|0_2() in Program.cs:line 24
at Program.<<Main>$>g__MiddleAsync|0_1() in Program.cs:line 14
at Program.<<Main>$>g__OuterAsync|0_0() in Program.cs:line 8
at Program.<Main>$(String[] args) in Program.cs:line 3
at Program.<Main>(String[] args)
The benefit: profilers, APM tools and debuggers show your methods, not compiler machinery: faster diagnosis during incidents. The runtime also reuses continuation objects, which reduces allocations, without changing a line of code.
Good to know: the
feature
remains opt-in for your application code (no
EnablePreviewFeatures needed on net11.0), and exception
stack traces were already clean. Turn it on for one service, measure, then roll it
out.
⚡ NativeAOT CLI & MSBuild Server by Default
The why: until now, every dotnet command booted a
managed host and a cold MSBuild process. The .NET 11 SDK now ships a
NativeAOT-compiled CLI entry point and keeps a warm MSBuild server alive between
builds.
# Nothing to change: enabled by default with SDK 11.0.100
dotnet --version # runs natively without booting the managed runtime
dotnet build # reuses an already warm MSBuild process
dotnet test # same tight feedback loop locally
# Need to opt out for a specific tool or script?
DOTNET_CLI_ENABLEAOT=false
DOTNET_CLI_USE_MSBUILD_SERVER=false
The benefit: a faster local feedback loop across everyday commands, without changing a single line of code or config.
🚀 Launching a Process: One Statement
The why: running a command and reading its output meant configuring
a ProcessStartInfo, reading the stream, then waiting for the exit.
// Before
var startInfo = new ProcessStartInfo("git", "status --porcelain")
{
RedirectStandardOutput = true,
UseShellExecute = false
};
using var process = Process.Start(startInfo)!;
var output = await process.StandardOutput.ReadToEndAsync();
await process.WaitForExitAsync();
// After
ProcessTextOutput result = await Process.RunAndCaptureTextAsync("git", ["status", "--porcelain"]);
The benefit: Process.RunAndCaptureTextAsync collapses
that ritual into one statement. Output, errors and exit code come back in a single
typed result: less infrastructure code, and an exit code you no longer forget to
check.
🛡️ The NuGet Cooldown: --min-publish-age-hours
The why: with no safeguard, a version published five minutes ago can land in your build. The .NET 11 SDK enforces a minimum age: any younger version is ignored during selection.
dotnet nuget update source nuget.org --min-publish-age-hours 72 --configfile nuget.config
The benefit: compromised versions are often pulled within hours. In
September 2025, the trojaned chalk and debug releases on
npm were unpublished within the day: a waiting period would have kept them out of
your builds.
My recommendation: 3 to 7 days. Enough time for scanners and
maintainers to battle-test a release before your production environments. The
practice is established in JavaScript:
Renovate
has offered it for years (3 days for npm in
config:best-practices), pnpm since 10.16. The .NET tooling had no native equivalent.
🗂️ Other Changes at a Glance
The why: smaller additions, useful day to day.
// Extension indexer (inside a static class)
extension(IEnumerable<int> sequence) { public int this[int index] => sequence.ElementAt(index); }
// LINQ: full join, tuples returned
var rows = products.FullJoin(categories, product => product.Category, category => category.Name);
// New key-selector overload (the delegate-based version dates from .NET 8)
var byName = EqualityComparer<Person>.Create(person => person.Name);
// File-based app split across files
#:include helpers.cs
Also shipping: Zstandard compression
(ZstandardStream), OpenAPI 3.2 and async validation (ASP.NET Core /
DataAnnotations), Blazor CacheView, .NET MAUI on CoreCLR
by default, IEEE 754 decimal types (Decimal32, Decimal64,
Decimal128), X25519DiffieHellman and AES Key Wrap. The
full list lives on the official
.NET 11
and
C# 15
pages.
🧨 The Breaking Changes to Watch
The official list is mostly behavioral: the code still compiles, the result changes. Only your tests can see it. Three families matter.
🔢 More Accurate Math, Different Results
The why: rounding, conversions and casts become exact and
deterministic. Microsoft estimates about 5% of values were rounded incorrectly by
the old Math.Round.
Math.Round(655.925, 2, MidpointRounding.AwayFromZero);
// .NET 10: 655.93 (wrong: 655.925 is stored as 655.92499999...)
// .NET 11: 655.92 (correctly rounded)
decimal price = (decimal)1.23; // .NET 11: 1.229999999999999982236431606
decimal fixedPrice = 1.23m; // the reliable literal for handling monetary amounts
static short ToShort(double value) => unchecked((short)value);
ToShort(65578.0);
// .NET 10: 42 in practice on CoreCLR, never guaranteed
// .NET 11: 32767 (saturated at the bound)
Action: regenerate test snapshots, check persisted amounts computed
with double, and audit casts used as indexes.
📣 Failures That Finally Show
The why: my favorite breaking change. What used to fail silently
now fails loudly: the generic host (see Act 2), corrupted ZIP entries (CRC32 check,
InvalidDataException) and invalid calls to DateOnly /
TimeOnly.TryParse.
DateOnly.TryParse("2026-11-10", CultureInfo.InvariantCulture, (DateTimeStyles)999, out var date);
// .NET 10: false, the programming bug goes unnoticed
// .NET 11: ArgumentException, the bug is impossible to miss
Action: fix the faulty calls and handle
InvalidDataException on archives received from outside. For the host,
nothing: this is the right behavior.
🖥️ Platform and Packaging
The why: the minimum CPU moves to x86-64-v2 (SSE4.2, POPCNT: older
CPUs went out of support around 2013), NativeAOT adds the lib prefix on
Unix and skips the full Build target during publish (BeforeBuild
/ AfterBuild no longer run), and DSA is removed from macOS.
# On a CPU without SSE4.2 and POPCNT, the runtime refuses to start:
The current CPU is missing one or more of the baseline instruction sets.
# NativeAOT on Unix
foo.so → libfoo.so
Action: check old build agents and emulated VMs, update packaging scripts, and move DSA to ECDSA or RSA.
🤖 Act 4: The Migration Harness
A feature is only a guarantee if the build makes it mandatory.
closed without CS8509 as an error is one more warning in a
list nobody reads.
<PropertyGroup>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<WarningsAsErrors>$(WarningsAsErrors);CS8509;CS8655</WarningsAsErrors>
</PropertyGroup>
+-------------------------------------------------------------------+
| MIGRATION HARNESS TO .NET 11 |
+-------------------------------------------------------------------+
| [global.json] Pinned SDK, bumps proposed by Renovate |
| ▼ |
| [Multi-target] net10.0 + net11.0: same tests, two runtimes |
| ▼ |
| [Characterization tests] rounding, casts, parsing, exit codes |
| ▼ |
| [WarningsAsErrors] CS8509 / CS8655: exhaustiveness enforced |
| ▼ |
| [NuGet] min-publish-age-hours: supply-chain cooldown |
+-------------------------------------------------------------------+
Characterization tests pin your critical rounding, conversion and
parsing results today: every divergence on net11.0 becomes a red test,
not a support ticket. And for AI agents, an exhaustive switch is a
constraint no convenient default can dodge.
⚖️ Act 5: What Changes Day to Day & Conclusion
The summary in concrete situations: what you get today, and what .NET 11 gives you.
+-----------------------------+-------------------------------+-------------------------------+
| Situation | With .NET 10 / C# 14 | With .NET 11 / C# 15 |
+-----------------------------+-------------------------------+-------------------------------+
| Subtype missed in a switch | Exception in production | Flagged at build (shift left) |
| "Paid OR declined" result | Exception or custom wrapper | union PaymentResult |
| Leaving 2 nested loops | Boolean control flag | break outer |
| Stack trace in a profiler | 13 frames, 8 of them plumbing | 5 frames, all yours |
| Local dotnet build / test | Managed host + cold MSBuild | NativeAOT CLI + warm server |
| Run git and read its output | ~8 lines of setup | 1 call |
| Failing worker | Exit code 0 (success!) | Exception, failure code |
| Version published 1 h ago | Picked on package add | Skipped by the cooldown |
+-----------------------------+-------------------------------+-------------------------------+
🧭 Should You Migrate? Yes, and Every Release
The why: since .NET 9, an STS release is supported for 24 months: .NET 11 is supported until November 14, 2028—the exact same date as .NET 10 LTS (while .NET 8 LTS and .NET 9 both reached end of support on November 10, 2026). Skipping STS releases no longer buys stability, only a bigger jump.
// global.json: the yearly upgrade fits in one line, proposed by Renovate
{
"sdk": {
- "version": "10.0.100",
+ "version": "11.0.100", // .NET 11 GA SDK (November 10, 2026)
"rollForward": "latestFeature"
}
}
The benefit: a single list of breaking changes to read, a PR reviewed within the day. Skipping two releases turns the upgrade into a project, and projects get postponed. It is Lehman's first law (1974): software in use must be continually adapted, or it becomes progressively less satisfactory.
The common thread of .NET 11 is early feedback: exhaustiveness checked at build time, business outcomes carried by types, failures that surface instead of being swallowed. The compiler becomes your first reviewer.
Over to you: how many useless _ => throw cases are
sleeping in your codebase, waiting for the next subtype?