feat(Async): Add exception-unwrapping Await#19785
Draft
bartelink wants to merge 1 commit into
Draft
Conversation
Contributor
❗ Release notes required
|
c1919eb to
b2b2b6a
Compare
Author
|
@T-Gro if you and/or others can give this a quick scan please, I'd like to confirm:
TL;DR the overall proposition
CC @TheAngryByrd @gusty @njlr who have provided useful feedback/review on stuff in this space in recent times |
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.
Implements
Async.AwaitforTask,Task<'T>,ValueTaskandValueTask<'T>(aka the communityAwaitTaskCorrectimplemention)Key differentiation from
Async.AwaitTaskis thatAggregateExceptions are unwrapped such that atry ... with <ExceptionType> ->will type-match correctly.Key distinction from the canonical implementation (which derives from https://www.fssnip.net/7Rc/title/AsyncAwaitTaskCorrect) is that the implementation is intended to have 1:1 matching of all stacktrace preservation properties borne by
AwaitTask(and continue to track that over time).NOTE one key implementation decision is that this PR does NOT attempt to resolve #2127 so:
Awaitis invoked, normal cancellation semantics as perAwaitTaskapply:OperationCanceledExceptionTaskin question'sResultwill go unobservedAwait, it will (likeAwaitTask):Taskawaitwould] until such time as theTaskcompletes (either successfully, with a fault, or via cancellation)Checklist
Awaitcan technically still propagate anAggregateExceptionAwaitTaskwill always yield anAggregateExceptionAwaitTaskshould be considered deprecated (and may in future be subject toObsoleteion warnings?)Awaitshould be the used in preference for new code