Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not flag CA1508 inside Debug.Assert() #7327

Closed
RenderMichael opened this issue Jun 13, 2024 · 2 comments
Closed

Do not flag CA1508 inside Debug.Assert() #7327

RenderMichael opened this issue Jun 13, 2024 · 2 comments

Comments

@RenderMichael
Copy link
Contributor

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.

@CollinAlpert
Copy link
Contributor

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

@RenderMichael
Copy link
Contributor Author

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

@RenderMichael RenderMichael closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants