try
{
await _storage.UploadAsync(blob);
}
catch (IOException)
{
throw;
}Deterministic window match: flags a `catch` whose body, read across the next five lines, is exactly `throw;`.
`catch (...) { throw; }`: a handler whose only statement rethrows. It changes nothing and adds a try block to read.
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.
try
{
await _storage.UploadAsync(blob);
}
catch (IOException)
{
throw;
}Deterministic window match: flags a `catch` whose body, read across the next five lines, is exactly `throw;`.
try
{
await _storage.UploadAsync(blob);
}
catch (IOException ex)
{
throw new UploadFailedException($"Upload of {blob.Name} failed", ex);
}Delete the try/catch. Use `finally` for cleanup, or `throw new SomeException("context", ex)` when you need to add context.
Agents wrap calls in try/catch by reflex, then find they have nothing to do with the error and rethrow it. The scaffolding stays.
ai-slop/csharp-empty-catch-rethrow
ai-slop
Deterministic window match: flags a `catch` whose body, read across the next five lines, is exactly `throw;`.
Catches that log, clean up, or wrap the exception (`throw new X(..., ex)`) before rethrowing 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.