Repository navigation
Set runtime-async compiler flag in Directory.Build.props - #4165
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
APPROVE
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
akira28
approved these changes
Nov 10, 2026
Add <Features>runtime-async</Features> to Directory.Build.props. The .NET 11 BCL ships compiled with runtime-async=on; this extends coverage to user code. In preview 7, the flag correctly passes -features:runtime-async to the Roslyn compiler but does not yet change async state machine generation — state machine types are still emitted. The flag is forward-compatible: when the Roslyn implementation lands at GA, the setting is already in place. AOT measurements (osx-arm64, net11.0, runtime-async flag set): - docs-builder: 58 MB / ~69 s publish / 113 ms startup - essc: 18 MB / ~20 s publish / 136 ms startup Numbers are flat vs the net11.0 baseline (expected — no IL change yet). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The correct MSBuild property to opt into Runtime Async is <Features>runtime-async=on</Features>. The bare value <Features>runtime-async</Features> is accepted by the compiler but does not enable the feature. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Mpdreamz
force-pushed
the
chore/dotnet-11-runtime-async
branch
from
November 11, 2026 07:01
003e2a2 to
bacb743
Compare
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4165/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Set
<Features>runtime-async=on</Features>inDirectory.Build.propsso the Runtime Async codegen path is enabled for every project in the solution. The .NET 11 BCL already ships compiled withruntime-async=on; this flag extends that coverage to user code, producing cleaner live stack traces, lower async overhead, and NativeAOT-compatible suspension. See What's new in .NET 11 runtime — Runtime Async for the full feature description.Affects: Automation
Prompt summary: PR 2 of the .NET 11 migration stack: record AOT baseline numbers and opt into the Runtime Async codegen path. The flag is the prep work; the AOT measurements are in this PR body rather than in code.
Why
The .NET 11 BCL ships compiled with
runtime-async=on, meaning the standard library's async methods are already on the new codegen path. Without this flag, user code builds against an optimised BCL but the compiler leaves all user-defined async methods on the state-machine path. Setting<Features>runtime-async=on</Features>extends coverage to the docs-builder codebase.Runtime Async V2 in .NET 11 RC 1 replaces compiler-generated async state machines with runtime-managed suspension and resumption. Instead of emitting
<Method>d__Nstate-machine classes, the runtime itself tracks async execution. The most visible win is in live stack traces: compiler-generated async produces multiple infrastructure frames per method; Runtime Async shows the actual call chain directly.What
Runtime Async opt-in
<Features>runtime-async=on</Features>added to the centralPropertyGroupinDirectory.Build.props, adjacent to<LangVersion>preview</LangVersion>. TheFeaturesproperty is a semicolon-separated list that MSBuild passes directly tocsc. Our entry ends up appended after the SDK's ownrun-nullable-analysis=neverentry — that entry is set by the SDK automatically for implicitly-triggered builds (IDE design-time, background restores) to skip the expensive nullable flow analysis pass; it does not appear in regulardotnet buildinvocations and is not something we set. To opt a project back out of Runtime Async, set<UseRuntimeAsync>false</UseRuntimeAsync>in that project file.AOT baseline (osx-arm64, net11.0, Release)
Measured on preview.7 (the installed SDK). The Runtime Async codegen change lands fully in RC 1 — numbers on RC 1 / GA will differ, especially for binary size, because state-machine types are replaced with runtime-managed continuations.
--help)docs-builderesscCold startup is measured immediately after
dotnet publishwhen the binary is not in the kernel's page cache. Warm startup (binary already paged in from a previous run) drops to ~25 ms — matching the system-installed binary on the same machine. On CI, first invocation is cold; subsequent invocations in the same job are warm.When the stack is rebased onto an RC 1 or GA SDK, async-heavy paths (the Markdown pipeline, the assembler's concurrent build phase, the Elasticsearch exporter) should see reduced AOT binary size and lower allocation pressure in high-throughput async code paths.
Verify
Stack: 2 of 3, on top of #4163
🤖 Generated with Claude Code