Closed RenderMichael closed 3 months ago
Already implemented in https://github.com/dotnet/roslyn-analyzers/pull/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.
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 byCA1508
.