An async method waits with Task.WaitAll or Task.WaitAny, which block the thread where WhenAll and WhenAny would await

tx0/csharp:blocking-wait-all-in-asyncrecommendedwarningperformance/iodepth fastbug, performance

What it finds

Task.WaitAll holds the calling thread until every task is done, which defeats the purpose of an async method and can deadlock under a synchronization context. await Task.WhenAll(...) waits without blocking.

From the rule's source, blocking_wait_all_in_async.rs.

Example from the rule's tests
using System.Threading.Tasks; class Batch{    async Task Run(Task a, Task b)    {        Task.WaitAll(a, b);tx0 reports: Task.WaitAll blocks inside an async method        await Task.WhenAll(a, b);    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:blocking-wait-all-in-async" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:blocking-wait-all-in-async] reason="..."

tx0 explain tx0/csharp:blocking-wait-all-in-async shows the same in the terminal. Found a false positive? Report it.