Repository navigation
Emit async method thunks in Native AOT - #121565
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements async method thunks in Native AOT by replacing a ThrowNotSupportedException placeholder with actual IL generation code in the EmitAsyncMethodThunk method. The implementation mirrors the existing CoreCLR VM C++ implementation to ensure consistency across runtimes.
Key Changes
- Removed the NotSupportedException throw and implemented full IL generation for async method thunks
- Added logic to handle both ValueTask and Task return types (generic and non-generic variants)
- Implemented instantiation handling for generic types and methods
- Added cross-reference comments between C++ and C# implementations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/vm/asyncthunks.cpp | Updated comment capitalization and added cross-reference comment to C# implementation |
| src/coreclr/tools/Common/TypeSystem/IL/Stubs/AsyncThunks.cs | Implemented full async method thunk IL generation matching CoreCLR VM behavior, handling ValueTask/Task paths with completion checking and awaiting logic |
Contributor
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
This was referenced Nov 13, 2025
Open
MichalStrehovsky
approved these changes
Nov 13, 2025
MichalStrehovsky
left a comment
Member
There was a problem hiding this comment.
This looks good to me, however the failure in the Checked leg is real. You'll need to wait for #121573 to clear it.
eduardo-vp
enabled auto-merge (squash)
November 13, 2025 22:11
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The method matches EmitAsyncMethodThunk in CoreCLR.