public User GetUser(int id)
{
return _client.GetUserAsync(id).Result;
}Deterministic line match on masked source: flags `.Result` member access, `.Wait()`, and `.GetAwaiter().GetResult()`.
Blocking on a task with `.Result`, `.Wait()`, or `.GetAwaiter().GetResult()`. It ties up a thread and can deadlock under a synchronization context.
Each example shows the exact code shape the rule is looking for, then the smallest version that keeps the intent without hiding risk or adding noise.
public User GetUser(int id)
{
return _client.GetUserAsync(id).Result;
}Deterministic line match on masked source: flags `.Result` member access, `.Wait()`, and `.GetAwaiter().GetResult()`.
public async Task<User> GetUserAsync(int id)
{
return await _client.GetUserAsync(id);
}`await` the task and make the caller async. If you genuinely hold a completed task and must block, add a short comment naming that invariant.
When an async API has to be called from synchronous code, agents block on it instead of making the caller async. It works in a quick test and deadlocks in UI or classic ASP.NET contexts.
ai-slop/csharp-sync-over-async
ai-slop
Deterministic line match on masked source: flags `.Result` member access, `.Wait()`, and `.GetAwaiter().GetResult()`.
Calls with a `//` comment on either of the two lines above (stating why blocking is safe), and `.Wait(...)` overloads that take arguments, are not flagged.
Part of aislop's C# rule set. First-class C# support, including C#-specific AI-slop rules, arrived in aislop v0.14.1.