Uh oh!
There was an error while loading. Please reload this page.
Enable runtime-async feature switch for NativeAOT System.Private.CoreLib - #123952
Conversation
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
agocke
commented
Feb 26, 2026
@MichalStrehovsky Some interesting failures in loongarch and riscv here. Is there work we have to do for those platforms? |
MichalStrehovsky
commented
Feb 26, 2026
I think this is a JIT assert, we likely haven't done any work on Risc/Loong (we certainly haven't done things like hijacking either and there's a tracking issue somewhere). I'd just not enable runtime-async corelib on those two architectures for now. Btw, we also have a private copy of the framework assemblies, so we could theoretically also enable runtime-async when building native AOT runtime packs. |
MichalStrehovsky
commented
Feb 26, 2026
Ah, maybe we stopped building those in a separate leg with source build. So maybe can't do that one anymore. |
agocke
commented
Feb 26, 2026
I excluded loongarch and riscv and that seems to have worked |
There was a problem hiding this comment.
Pull request overview
This PR enables the runtime-async compiler feature for NativeAOT's System.Private.CoreLib by adding the Features=runtime-async=on property in the csproj file. The feature switch transforms async methods to use the runtime's native async support instead of compiler-generated state machines, improving performance. The PR also suppresses CA2252 warnings that arise from compiler-generated calls to AsyncHelpers.Await methods marked with preview feature attributes. The feature is currently disabled for riscv64 and loongarch64 architectures.
Changes:
- Enabled
runtime-async=onfeature flag for NativeAOT System.Private.CoreLib (excluding riscv64/loongarch64) - Suppressed CA2252 analyzer warning for preview feature usage at the project level
jkotas
commented
Feb 26, 2026
I am not able to find it. If there is not one, we should create it (one per arch) and link it from this change |
MichalStrehovsky
commented
Feb 27, 2026
It's #122492. But we're disabling runtimeasync on LoongArch/RiscV because of RyuJIT asserts when compiling. We don't even get to hijacking. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Description
Enables the
runtime-asynccompiler feature for the core libraries when building for Native AOT.Changes
<Features>$(Features);runtime-async=on</Features>to NativeAOT System.Private.CoreLib csprojruntime-async=oncauses the compiler to injectAsyncHelpers.Awaitcalls which are marked[RequiresPreviewFeatures]Notes
The CA2252 suppression is project-scoped because
runtime-async=ontransforms all async methods via compiler-generated calls—individual method suppression isn't practical or meaningful here. This is consistent with how other runtime-async-enabled projects handle it (e.g., tests disable analyzers entirely).Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.