Enable runtime-async feature switch for NativeAOT System.Private.CoreLib#123952
Enable runtime-async feature switch for NativeAOT System.Private.CoreLib#123952
Conversation
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
| <PropertyGroup> | ||
| <Features>$(Features);runtime-async=on</Features> | ||
| <!-- Suppress warnings for using methods that require opting into preview features (AsyncHelpers.Await calls) --> | ||
| <NoWarn>$(NoWarn);CA2252</NoWarn> |
There was a problem hiding this comment.
I had to suppress <NoWarn>$(NoWarn);SYSLIB5007</NoWarn> in #119432 as well. Possibly just a different way to suppress the same build errors?
I wonder what is the scenario when we see AsyncHelpers.Await marked as preview features?
I think they are no longer marked as experimental.
There was a problem hiding this comment.
My theory was that we were building something against net10, perhaps temporarily for some build/codeflow related reasons.
But maybe the reason is something else.
I did not look deeply, just disabled the warnings to get them out of the way, but I kind of wonder why we need to do this.
There was a problem hiding this comment.
Isn't this because we mark AsyncHelpers as RequiresPreviewFeatures?
There was a problem hiding this comment.
Ah. There is another marker.
@agocke - perhaps it is time to remove [RequiresPreviewFeatures]?
I assume we do not plan to ship with this?
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.