Skip to content

TrySetResultAsync missing in 120 version, how to handle this? #4660

Closed Answered by campersau
lofti198 asked this question in Q&A
Discussion options

You must be logged in to vote

The extension method got removed with the upgrade to .NET Framework 4.6.2 here:
1def8a7#diff-fab8d4eeceb0db5072815c35d8efa6886d14f4529f7ce4d9d228682422e492c4L95-L108

You can create a TaskCompletionSource with TaskCreationOptions.RunContinuationsAsynchronously option and just use TrySetResult.

var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);

tcs.TrySetResult(true);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by amaitland
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants