Skip to content

Use Result instead of GetAwaiter().GetResult() #13614

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 1 commit into from
Sep 3, 2019

Conversation

Kahbazi
Copy link
Member

@Kahbazi Kahbazi commented Sep 2, 2019

Addresses #13611

@Pilchie Pilchie added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Sep 3, 2019
@pranavkm
Copy link
Contributor

pranavkm commented Sep 3, 2019

@Kahbazi as discussed in #13611, the GetAwaiter().GetResult() is intentionally used to produce a better async exception stack trace. We use this fairly commonly through our code base.

Closing this PR since the change isn't desirable.

@pranavkm pranavkm closed this Sep 3, 2019
@Kahbazi
Copy link
Member Author

Kahbazi commented Sep 3, 2019

But in this case there will be never any exception since IsCompletedSuccessfully has been checked. So I think calling Result has better performance then GetAwaiter().GetResult.
Also Result has been used in similar cases in this repository.

@pranavkm pranavkm reopened this Sep 3, 2019
@pranavkm
Copy link
Contributor

pranavkm commented Sep 3, 2019

Yup, you're right.

@pranavkm pranavkm merged commit 88dbd1c into dotnet:master Sep 3, 2019
@pranavkm
Copy link
Contributor

pranavkm commented Sep 3, 2019

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants