Skip to content

Configure await (ARCH105)

Key dotnet.async.configure-await · Severity info · Category async

Use ConfigureAwait(false) on await calls in library code. This avoids unnecessary synchronization context capture and reduces deadlock risk.

public async Task<Order> GetOrderAsync(int id)
{
return await _repository.FindAsync(id);
}
public async Task<Order> GetOrderAsync(int id)
{
return await _repository.FindAsync(id).ConfigureAwait(false);
}

Append ConfigureAwait(false) to await expressions inside library code. If needed, suppress the rule per project/workspace via except/ignore.