Skip to content

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

Merged
merged 2 commits into from
Jan 28, 2021
Merged

Conversation

Kahbazi
Copy link
Member

@Kahbazi Kahbazi commented Jan 28, 2021

No description provided.

@Kahbazi Kahbazi requested review from halter73, jkotalik, Tratcher and a team as code owners January 28, 2021 06:05
@javiercn javiercn added the community-contribution Indicates that the PR has been added by a community member label Jan 28, 2021
@@ -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();
Copy link
Member

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?

Copy link
Member

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

Copy link
Member

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.

@Pilchie Pilchie added area-blazor Includes: Blazor, Razor Components area-servers labels Jan 28, 2021
Copy link
Member

@javiercn javiercn left a 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.

@Pilchie Pilchie merged commit 360b80e into dotnet:main Jan 28, 2021
@Pilchie
Copy link
Member

Pilchie commented Jan 28, 2021

Thanks @Kahbazi !

@ghost
Copy link

ghost commented Jan 28, 2021

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.

@Kahbazi Kahbazi deleted the patch-17 branch January 28, 2021 18:46
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants