joshcomley
joshcomley

Reputation: 28818

Catching a missing call to await

Other than writing my own Roslyn based code analysis tool to find such code, is there a simple way to find calls to methods that return a Task object, but that are not awaited?

Upvotes: 0

Views: 67

Answers (1)

Stephen Cleary
Stephen Cleary

Reputation: 456507

There is already a compiler warning for this, unless you turn it off or write code explicitly to suppress the warning (such as assigning the returned task to a variable).

Personally, I prefer to have compiler warnings as errors.

Upvotes: 4

Related Questions