Skip to content
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

Forbid Task.Result & Task.Wait() in methods returning task. #67

Open
brian-reichle opened this issue Jan 19, 2019 · 2 comments
Open

Forbid Task.Result & Task.Wait() in methods returning task. #67

brian-reichle opened this issue Jan 19, 2019 · 2 comments

Comments

@brian-reichle
Copy link
Contributor

Should add a rule to suggest await over Task.Result or Task.Wait() within methods returning Task (potentially requiring the method to be made async).

Should probably also apply within methods that are already async void, but definitely shouldn't suggest making a method async void.

@yaakov-h
Copy link
Member

.Result could be acceptable if it has already been awaited with Task.WhenAll and friends.

Should also look for .GetAwaiter().GetResult()

@brian-reichle
Copy link
Contributor Author

Good point, also when accessed from within the Task.ContinueWith callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants