deniz.in

Markets

Weather

Loading weather

· via dev.to (home feed)

.NET 11's Runtime Async cuts async allocations with no code changes

At .NET Conf 2026 Microsoft pitched Runtime Async as a .NET 11 highlight: async execution moved into the runtime, cutting Task allocations on synchronous paths and cleaning up live call stacks via an opt-in project flag.

.NET 11's Runtime Async cuts async allocations with no code changes

Runtime Async moves async execution into the runtime

At .NET Conf 2026, Microsoft presented Runtime Async as a headline improvement in .NET 11, the release that shipped on November 10. Rich Lander and Andy Gocke used their session to demonstrate what the change does to allocations and to the call stacks developers read while debugging. A dev.to write-up by kasuken, published after the conference, picked it as the first .NET 11 feature worth trying.

The feature replaces a longstanding compiler technique. Roslyn has historically lowered each async method into a compiler-generated state machine. Runtime Async moves suspension and resumption into the runtime itself, which lets the JIT optimize across method boundaries. When a chain of directly awaited calls finishes without suspending, the JIT can skip building some of the intermediate Task objects that would otherwise appear. Tasks that callers hold on to for later still need to be allocated.

Allocation numbers from Microsoft and an independent run

Microsoft's conference benchmark modeled a backup job whose typical work is verifying file timestamps. Across seven async frames, the benchmark reported 504 bytes allocated per operation with compiler-generated state machines and none with Runtime Async, on a path that completed without suspending.

The dev.to author reproduced the effect on a smaller scale, using a console app built with SDK 11.0.100 in Release on Windows x64 and a completed task created up front to represent an inventory cache hit. After warmup, the loop allocated 144 bytes per operation under default compiler settings and zero with Runtime Async, with identical results in both runs. Their guidance is to measure fast cache paths separately from real I/O, since a call that actually suspends will not show the same savings.

Adoption is a compiler switch, not a rewrite

According to the dev.to article, the .NET 11 runtime libraries already use Runtime Async internally. Turning it on for application code is a preview feature, enabled through a PropertyGroup in the project file that sets Features to runtime-async=on. A net11.0 project can use the switch without unlocking every other preview feature, so the same codebase can be benchmarked with the flag on and off.

Live call stacks lose the machinery

The debugging change may be the one developers notice first. Printing Environment.StackTrace from inside executing async code showed AsyncMethodBuilderCore.Start and repeated method entries under default compiler settings, according to the same write-up. With Runtime Async enabled, each async method appeared exactly once, with no builder frames separating them. Exception traces are a separate diagnostic, since they already hide much of the async plumbing.

The rest of the .NET 11 story

The conference carried other announcements that the dev.to author and the NetMentor recap both flagged. NetMentor ranked tooling first: on Microsoft's 407-project Aspire solution, C# Dev Kit 11 reduced a single-file rebuild in VS Code from 36.1 seconds to 2.1 seconds, and a no-change build from 34.4 seconds to under a second. File-based C# apps can now include additional source files using #:include, and .NET 11 enables the Native AOT CLI host by default, so short commands such as dotnet --version no longer start the managed CLI. Multithreaded MSBuild remains a separate opt-in through its -mt switch, and the dev.to author suggests testing it on a branch in case custom targets behave differently.

On the language side, C# 15 introduces unions, letting a fixed set of outcome types replace status enums with fields that only apply sometimes; the compiler can flag switch expressions that miss a newly added case. System.Text.Json can serialize union cases, but deserialization needs a way to tell them apart, which matters where JSON shapes overlap. In Blazor, Daniel Roth's replacement-order demo used a custom AsyncValidationAttribute run by the built-in DataAnnotationsValidator, with EditContext.IsValidationPending driving an interface that shows the check is still running.

Why it matters

Async and await sit underneath most modern C# services, and their cost has long been paid twice: in allocations on hot paths and in stack traces cluttered with state-machine plumbing. Runtime Async addresses both without requiring changes to application code — a runtime-level optimization unlocked by a single project setting, with zero-allocation results already visible on synchronously completing paths. The caveats are real: app-level use is still a preview, the largest wins come from code that finishes inline rather than suspending, and Microsoft's numbers come from purpose-built benchmarks. Teams running allocation-sensitive services have a cheap experiment available: flip the switch, measure both paths, and read a call stack that finally resembles the source.

  • #dotnet
  • #csharp
  • #async
  • #dotnet-conf
  • #runtime