debug-fail-message
What it does
Section titled “What it does”Reports a Debug.Fail call with a constant blank message. With the type layer the call is checked against System.Diagnostics.Debug; without it any call written Debug.Fail is. No fix.
Why it matters
Section titled “Why it matters”Debug.Fail is reached only when something is wrong, and the message is the only information about what. An empty message leaves the reader of the failure with a stack trace and no idea of the cause.
To fix, say what went wrong.
Example
Section titled “Example”... Debug.Assert(true, "why"); Debug.Fail(""); }... public void Own() { }...... Debug.Assert(true, "why"); Debug.Fail(""); }... public void Own() { }...Configuration
Section titled “Configuration”csharp: lint: rules: debug-fail-message: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line debug-fail-message in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| StyleCop | SA1406 |
full |