-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Consume ValueTask with GetAwaiter().GetResult() #29710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -236,6 +236,9 @@ public Task DisposeInBatchAsync(RenderBatchBuilder batchBuilder) | |||
var result = ((IAsyncDisposable)Component).DisposeAsync(); | |||
if (result.IsCompletedSuccessfully) | |||
{ | |||
// If it's a IValueTaskSource backed ValueTask, | |||
// inform it its result has been read so it can reset | |||
result.GetAwaiter().GetResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidfowl do we need to do this across all places where we consume ValueTask?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. There's an uber issue with a bunch of violations in our code base wrt value task. @stephentoub filed the issue in 5.0 we should address those things in 6.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's #16876. Might as well go ahead and take this if someone wants to sign off on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signing-off on the component bits.
Thanks @Kahbazi ! |
Hi @Pilchie. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
No description provided.