-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Enable and audit dispose rule suppressions in Roslyn.sln (CA2000 and CA2213) #25880
Comments
Here are my expectations for these rules:
I consider steps 1-4 hard requirements (prerequisites) for enabling the analyzers in Roslyn.sln, and item 5 may only be relaxed for cases of bugs affecting a minority of code adhering to (4) where the analyzers failed to correctly implement the documented rules of (3). This approach is quite flexible in terms of the final approach, and represents a reasonable minimum acceptance bar that customers will have. 📝 I've requested this item go to the design meeting. This comment aims to document my expectations prior to the meeting so everyone is aware of them. |
Note that these are not new rules, which are being designed from scratch. There are already existing implementations of these rules in the binary FxCop world and there are extremely large number of code bases that rely on the current design/heuristics, especially since they have done the work to audit/suppress the violations. The analyzer implementation matches prior FxCop rule design/heuristics. This was already discussed at prior design meeting(s) and we decided:
Hence, we have already satisfied the requirements set by design time for this rule implementation. |
It is possible, and acceptable, for the design of CA2000 and CA2213 to deviate from the design of a set of usable |
I would be strongly opposed to having multiple heuristic based implementations of a specific rule, just to satisfy preferred heursitics for different code bases. This is not how we write analyzers, and is not a valuable use of anyone's time and resources. Instead we should attempt to improve the rule implementation to reduce dependence on heuristics, as suggested by possible approaches in dotnet/roslyn-analyzers#1617 (comment). |
Closing out due to lack of feedback. |
#25179 attempts to move us to newer analyzer packages that includes the experimental implementation of CA2000 and CA2213. There are quite a few differing opinions on what should be suppressed vs fixed, and we also have differing opinions on how dispose ownership transfer should be designed for the rule (dotnet/roslyn-analyzers#1617). Hence, we have decided to add suppressions for majority of dispose violations flagged in #25179. This issue tracks auditing these suppressions and fixing OR resolving by design.
The text was updated successfully, but these errors were encountered: