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
Replace Task.Result with await Task #734
Comments
If we do this, we would need to change all the callers to also be async. We can't cause a build problem after. This means cascade into several parts of the program. This is a huge task. Because of the cascading problem, I think we need to discuss it. |
Yes, this can introduce a huge change to the solution. Some functions can not be made async - for example, The more I think about this concept, the more I like it, too. After all, turning a program async is a pragmatic and menial task. |
If the method is already async and still uses |
I think this would be fair. This way, we won't cascade the conversion to async and introduce massive build errors. |
@giggio @ElemarJR @carloscds pinging you because the guidelines say that I should notify you before creating a PR. |
New analyzer: Replace
Task.Result
withawait
and make methodasync Task
Recently we've found some deadlocks in our code. They were caused by a stray
.Result
in situations when there was anasync
method earlier in the call stack. Using.Result
is considered a bad practice.I propose an analyzer that removes
.Result
and replaces it with anawait
callBefore:
After:
Category:
Design
Severity:
Warning
Diagnostic id:
CC0122
I'm curious what's your opinion on
.Result
is OK?The text was updated successfully, but these errors were encountered: