debug-assert-message
What it does
Section titled “What it does”Reports a Debug.Assert call without a message, or with a message that is a constant blank string. With the type layer the call is checked against System.Diagnostics.Debug; without it any call written Debug.Assert is. No fix.
Why it matters
Section titled “Why it matters”When an assertion fails in a debug build the message is all that is shown. Without it the developer has the line number and the condition, and a long sequence of asserts in a function does not tell which one broke or why it matters.
To fix, add a message that says what is wrong when the condition is false.
Example
Section titled “Example”... Debug.Assert(true); Debug.Assert(true, "why");... }...... Debug.Assert(true); Debug.Assert(true, "why");... }...Configuration
Section titled “Configuration”csharp: lint: rules: debug-assert-message: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line debug-assert-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 | SA1405 |
full |