async-suffix
What it does
Section titled “What it does”Reports an async method that returns Task or ValueTask and whose name does not end in Async. Overrides, explicit interface implementations and Main are not reported, because their names are not the method’s to choose. Renaming needs the binding layer, so there is no fix.
Why it matters
Section titled “Why it matters”The suffix tells the caller that the method returns a task that has to be awaited. A call that forgets await on Load() compiles and runs on without waiting, but LoadAsync() calls for it. It also leaves room for a synchronous Load() next to it.
To fix, rename the method to end in Async.
Example
Section titled “Example”...interface I { Task Run(); }class A : I { public async Task Run() { } public async Task Other() { }}class B { class Task { }...Configuration
Section titled “Configuration”csharp: lint: rules: async-suffix: warn # off (default), warn, errorSuppress one line with sudsy-disable-next-line async-suffix in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| Roslynator | RCS1046 |
full |