ErrorProne.NET icon indicating copy to clipboard operation
ErrorProne.NET copied to clipboard

Async rules

Open SergeyTeplyakov opened this issue 8 years ago • 8 comments

  • Warn on async void
  • Warn on Task.Result/Task.Wait prefer Task.GetAwaiter().GetResult because later will unwrap exception. Question: how to catch correct cases?
  • Warn on incorrect preconditions in async methods

SergeyTeplyakov avatar Mar 04 '16 07:03 SergeyTeplyakov

Add checks for naming rules. Wanr if async method doesn't have Async suffic or when non-async method has it (note, EAP could have the same suffic!).

SergeyTeplyakov avatar Mar 09 '16 06:03 SergeyTeplyakov

Non-synchronous preconditions in async methods.

SergeyTeplyakov avatar Mar 09 '16 06:03 SergeyTeplyakov

Warn on exception from async void method.

SergeyTeplyakov avatar Mar 11 '16 22:03 SergeyTeplyakov

Warn on run, Task.Factory.StartNew(async () => await Something)

werwolfby avatar Aug 16 '18 21:08 werwolfby

Analyze if an assembly defines an attribute like RequireConfigureAwait(true/false) and warn/enforce this thing.

SergeyTeplyakov avatar Aug 22 '18 05:08 SergeyTeplyakov

Warn if TaskCompletionSource instance is constructed without TaskCreationOptions that forces continuation to run asynchronously.

SergeyTeplyakov avatar Aug 23 '18 23:08 SergeyTeplyakov

Warn for _myStuff?.FooAsync(). This is never a good idea, because you'll end up with null task that you can't await or can't call GetAwaiter().GetResult() on.

SergeyTeplyakov avatar Aug 28 '18 18:08 SergeyTeplyakov

Consider implementing these rules in Microsoft/vs-threading, which includes a number of analyzers related to this space. The analyzers are intended for use with or without the supporting library.

sharwell avatar Apr 08 '19 13:04 sharwell