Why this matters
Silent failures are hard to diagnose and can corrupt state.
Never swallow exceptions silently; log with context and either rethrow or handle explicitly.
Silent failures are hard to diagnose and can corrupt state.
Side-by-side examples engineers can pattern-match during review.
try { DoWork(); } catch { }try { DoWork(); } catch (Exception ex) { _log.LogError(ex, "DoWork failed"); throw; }catch { }catch(Exception e){ _log.LogError(e, "context"); throw; }From the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.