Repository navigation
JIT: Fix runtime-async awaits of Task<T> upcast to Task - #137251
Merged
Merged
Conversation
Folding a Task<T>-returning call followed by AsyncHelpers.Await(Task) leaves an unconsumed result on the IL stack, causing InvalidProgramException. Discard the unused result in the JIT and interpreter while retaining the fold. Reuse the async variant's call info and skip signature queries for generic Await<T> calls, keeping the common path free of extra JIT-EE calls. Add regression coverage for completed and suspending tasks, ConfigureAwait, and different result types. Fixes dotnet#135215 Co-authored-by: Copilot <[email protected]> Copilot-Session: 31ebe810-b436-428b-9238-ba41ee05ed8d
|
Azure Pipelines: Successfully started running 5 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
BrzVlad
reviewed
Nov 10, 2026
Identify void Await overloads from the token kind instead of querying their signatures. Track isVoidAwait in the interpreter and retain the async variant return-type check before discarding its result. Co-authored-by: Copilot <[email protected]> Copilot-Session: 31ebe810-b436-428b-9238-ba41ee05ed8d
BrzVlad
approved these changes
Nov 10, 2026
Member
Author
|
cc @dotnet/jit-contrib PTAL @AndyAyersMS |
AndyAyersMS
reviewed
Nov 11, 2026
AndyAyersMS
approved these changes
Nov 11, 2026
AndyAyersMS
left a comment
Member
There was a problem hiding this comment.
LGTM, just one possibly misleading comment?
AndyAyersMS
approved these changes
Nov 11, 2026
This was referenced Nov 12, 2026
Member
Author
|
/azp run runtime, runtime-coreclr superpmi-diffs, runtime-dev-innerloop |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Open
3 tasks
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.
Folding a
Task<T>-returning call followed byAsyncHelpers.Await(Task)leaves an unconsumed result on the IL stack, causing InvalidProgramException. Discard the unused result in the JIT and interpreter while retaining the fold.Reuse the async variant's call info and skip signature queries for generic Await calls, keeping the common path free of extra JIT-EE calls. Add regression coverage for completed and suspending tasks, ConfigureAwait, and different result types.
Fixes #135215