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

Feature: Adhere to ContractVerification attribute #4710

Closed
Youssef1313 opened this issue Jan 19, 2021 · 7 comments
Closed

Feature: Adhere to ContractVerification attribute #4710

Youssef1313 opened this issue Jan 19, 2021 · 7 comments

Comments

@Youssef1313
Copy link
Member

I found ContractVerification attribute by chance 😄

The description says:

Instructs analysis tools to assume the correctness of an assembly, type, or member without performing static verification.

So I believe we should adhere to it, or at least, have an option to that.

This should be applied to most (all?) analyzers.

@Youssef1313
Copy link
Member Author

This could even be a Roslyn feature, that is all analyzers (first-party and third-party) are configurable to whether to adhere to the attribute or not.

@Youssef1313
Copy link
Member Author

Tagging @terrajobst @stephentoub since this is related to .NET API usage.

@stephentoub
Copy link
Member

This attribute is specific to the System.Diagnostics.Contract system and rewriter. It is not related to Roslyn analyzers.

@Youssef1313
Copy link
Member Author

@stephentoub Should Pure attribute be the same? It's currently checked by CA1806.

@stephentoub
Copy link
Member

stephentoub commented Jan 19, 2021

Personally, I don't think CA1806 should be paying attention to it.
dotnet/runtime#34098 (comment)
Or, rather, in and of itself, there's little technical harm in its doing so, except that it encourages further use of the attribute, which in my opinion is misguided.

@Youssef1313
Copy link
Member Author

Youssef1313 commented Jan 19, 2021

it encourages further use of the attribute, which in my opinion is misguided.

Yes, I'm one of those who wanted to add the attribute anywhere it could benefit from CA1806.

@mavasani Are you okay with dropping Pure from CA1806? (Probably only after a new runtime attribute is introduced because some customers may be relying on the existing attribute)

Tagging @sharwell @333fred as well (#1164 #1171)

@stephentoub I think it also makes sense for the API docs of Pure to be clear about the actual intent of the attribute

@mavasani
Copy link
Contributor

We are not going to add support for ContractVerification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants