A method is named with the suffix Async but returns neither a task nor an async stream

tx0/csharp:async-suffix-on-sync-methodallwarningstyle/namingdepth fastsmell

What it finds

The suffix Async tells callers that a method returns something to await. A method that returns void or a plain value under that name invites await on something that cannot be awaited, or hides that a call blocks. The rule reports methods named ...Async whose declared return type is void or a built-in type, except overrides. The older event-based pattern of .NET names void methods ...Async and reports completion with an event, so the rule is in the all tier.

From the rule's source, async_suffix_on_sync_method.rs.

Example from the rule's tests
using System.Threading.Tasks; class Sender{    void SendAsync(string text)tx0 reports: SendAsync returns void, not a task    {    }     Task PostAsync(string text) => 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 all tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:async-suffix-on-sync-method" = "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-suffix-on-sync-method] reason="..."

tx0 explain tx0/csharp:async-suffix-on-sync-method shows the same in the terminal. Found a false positive? Report it.