A task is awaited in library code without ConfigureAwait, so the rest of the method resumes on the caller's context
What it finds
An await resumes on the synchronization context it started on, if there is one. Library code that does not need that context can use ConfigureAwait(false) to resume on any thread, which avoids deadlocks when a caller blocks on the task and saves a context switch. Application code, ASP.NET Core and tests have no context to return to, so the rule is in the all tier and skips files that use ASP.NET Core, xUnit, NUnit or MSTest.
From the rule's source, await_without_configure.rs.
using System.Threading.Tasks; class Client{ async Task Get(Task inner) { await inner;tx0 reports: this await resumes on the captured context await inner.ConfigureAwait(false); }} 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:
[rules]
"tx0/csharp:await-without-configure" = "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:await-without-configure] reason="..."tx0 explain tx0/csharp:await-without-configure shows the same in the terminal. Found a false positive? Report it.