suppression
Marking one diagnostic or scanner finding as intentionally ignored for some code, usually with an inline comment or attribute and a reason.
A broad suppression can hide a genuine defect the rule would have caught.
In more detail
Suppressions are sometimes necessary when a rule cannot apply, such as at a third-party boundary. Keep suppressions narrow and add a reason, because a blanket suppression hides the next real problem too.
Examples
#pragma warning disable CA2000[SuppressMessage("Reliability", "CA2000", Justification = "...")]The course lets a developer suppress one finding only with a reason visible in the diff, so the decision is reviewed.Related terms
- diagnostic — A message the compiler or an analyzer reports about code, carrying a rule identifier such as CA2000, a severity and an explanation.
- Roslyn analyzer — A plug-in to the C# compiler that inspects code while you edit and build, and reports diagnostics about likely bugs, unsafe patterns or style.
- false positive — A check result that claims something is true when it is not, such as a test passing on broken code or a tool flagging correct code.
- security exception — A recorded, time-limited decision to let a known finding through a gate, with a reason, an owner and an expiry date.
Taught in
- Code Quality: .editorconfig and Roslyn Analyzers — Modern .NET Core, C# & Enterprise Microservices
- Static Application Security Testing — Application Security & Threat Modeling for Engineers