dotnet / roslyn-analyzers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not flag `CA1508` inside `Debug.Assert()`

RenderMichael opened this issue · comments

Analyzer

Diagnostic ID: CA1508

Describe the improvement

When writing assertions with Debug.Assert, it is expected that the result is always true. Even if the true value is "dead conditional code", ie. if the assertion results are known to be true. Debug.Assert is still useful to protect the assumptions in case of a refactoring.

Describe suggestions on how to achieve the rule

The return value of Debug.Assert does not get flagged by CA1508.

Already implemented in #7014. Can you make sure you are using the newest version of the CodeAnalysis package?

Chalk this up to not searching through recently-closed issues. Thanks.