An async method calls a method ending in Async as a statement, without awaiting or keeping its task

tx0/csharp:unawaited-async-callrecommendedwarningreliability/concurrencydepth fastbug

What it finds

Inside an async method, a call such as SaveAsync(); on its own starts work whose end nobody waits for and whose exceptions nobody sees; the method may return before the work is done. Code that means to fire and forget usually says so with _ = SaveAsync();, which this rule leaves alone, as are methods of the same type with that name that return void.

From the rule's source, unawaited_async_call.rs.

Example from the rule's tests
using System.Threading.Tasks; class Store{    async Task Save()    {        WriteAsync();tx0 reports: the task of WriteAsync is neither awaited nor kept        await WriteAsync();        _ = WriteAsync();    }     void Sync() => WriteAsync();     Task WriteAsync() => Task.CompletedTask;}
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:unawaited-async-call" = "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:unawaited-async-call] reason="..."

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