C# Code Review Checklist for Pull Requests

Use this checklist during C# pull request review. Not every item applies to every change — focus on sections relevant to the files touched.

Video explainer (1:12) · Watch with transcript

Correctness and behavior

  • Does the change match the stated requirement or ticket?
  • Are edge cases handled (null inputs, empty collections, boundary values)?
  • Do unit or integration tests cover new behavior and regressions?

Exceptions and logging

  • No empty catch blocks unless explicitly documented
  • Exceptions logged with correlation or request context where available
  • No silent swallowing of failures in background or payment flows

Async and performance

  • Async methods use await rather than blocking calls
  • Database and HTTP calls are not accidentally synchronous in hot paths
  • Large allocations or N+1 query patterns flagged in data access code

Maintainability

  • Methods stay focused — consider splitting methods over ~50–80 lines
  • Class responsibilities are clear; avoid god classes
  • Naming reflects domain language, not implementation details only

Security

  • No hardcoded secrets or credentials in source
  • User input validated before use in queries, paths, or commands
  • Authorization checked at appropriate boundaries

Automated baseline

Run CodeInspector on the repository to verify checklist items that rules can enforce automatically — complexity thresholds, empty catches, hardcoded secrets, and missing logging patterns — especially before major releases.

Related