-
Notifications
You must be signed in to change notification settings - Fork 470
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
CA1062 raised if Contract.Requires uses TException #3030
Comments
@mavasani My understanding is that CodeContracts is deprecated so I am wondering whether we should add this exception. |
Is there something we want to do on this rule? I see it is disabled and meant to be replaced by a compiler warning. Do we want to deprecate this rule and remove it on the cc @mavasani |
I do not think we want to deprecate CA1062. I am also not sure if it is planned to be replaced with a compiler warning. It is disabled by default as it uses dataflow analysis, and hence can be noisy + expensive to be enabled by default. I think we certainly want to update CA1062 messaging to remove the words that recommend use of Code contracts. |
My comment was based on the comment left next to the
Do we want to simply remove this mention or change it to recommend System.Diagnostics.Contracts.Contract? |
Duplicate of #3134 |
Analyzer package
Microsoft.CodeAnalysis.FxCopAnalyzers
Package Version
v2.9.7 (Latest)
Diagnostic ID
CA1062
Repro steps
Contract.Requires<ArgumentNullException>(param != null)
Expected behavior
Nothing.
Actual behavior
CA1062 raised
CA1062 not raised if the TException is not used.
The text was updated successfully, but these errors were encountered: