A method is declared async but never awaits, so it runs synchronously and pays for a state machine

tx0/csharp:async-without-awaitrecommendedwarningmaintainability/designdepth fastsmell

What it finds

An async method without await runs to its end on the caller's thread and wraps its result in a task; the keyword adds a state machine and catches exceptions into the task without making anything asynchronous. Either an await is missing, or the method can drop async and return Task.FromResult or Task.CompletedTask. await foreach and await using count as awaits; awaits inside nested lambdas do not.

From the rule's source, async_without_await.rs.

Example from the rule's tests
using System.Threading.Tasks; class Loader{    async Task<int> Count()tx0 reports: Count is async but never awaits    {        return 3;    }     async Task<int> Fetch()    {        await Task.Yield();        return 3;    }     async Task Each(System.Collections.Generic.IAsyncEnumerable<int> items)    {        await foreach (var item in items)        {        }    }}
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:async-without-await" = "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:async-without-await] reason="..."

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