phasTrak / AsyncApostle

MIT License
20 stars 3 forks source link

Idea: Warn if async method is not awaited #4

Open mu88 opened 2 years ago

mu88 commented 2 years ago

Asuming the following code:

public void DoSomethingBig()
{
    DoSomethingSmallAsync();
}

public Task DoSomethingSmallAsync()
{
    return Task.Delay(100);
}

As you can see, DoSomethingSmallAsync() is not awaited within DoSomethingBig() which could lead to some problems.

That gets even more important if a team decides to avoid the regular Async method name suffix - you cannot spot it at a glance during code review.

What do you think about checking for not awaited asynchronous method calls? Is that even possible?

I'm also happy to provide a PR if you could assist me with some advices how to approach.

mu88 commented 2 years ago

@ristogod: any thoughts about that?