You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CA2224: have ==, so should have Equals
CA2218: have Equals, so should have GetHashCode
Now that we offer to fix these problems, it seems like it might be nice to have versions of these diagnostics that explain that they cannot be fixed. For example, if a base type shadows object.Equals, then there's no way to override it in a derived type. It would be helpful if the descriptions explained why (and what?) refactoring was required.
The text was updated successfully, but these errors were encountered:
@amcasey I am not sure to properly understand what you are suggesting. Do you mean that the code-fix should not be displayed in the case of a base type shadowing object.Equals? Are you suggesting a different type of code-fix in this case?
@Evangelink Sorry, I have to admit that I'm not as familiar with this issue as I was. Here's my best guess elaboration:
We have some diagnostics that say "problem x exists, you should do y" and we have code fixes that "do y". In cases where the code fix cannot be applied, the user still sees the diagnostic encouraging them to do what the code fix could not. Another approach would be to split the diagnostic in two: "problem x exists, you should do y", with a code fix, and "problem x exists {optional explanation}" without a code fix.
This is just a polish issue and it's had no thumbs up in 4.5 years, so I'm fine with just closing it.
mavasani
changed the title
Add more nuanced versions of CS2224 and CA2218
Add more nuanced versions of CA2224 and CA2218
Sep 4, 2020
CA2224: have ==, so should have Equals
CA2218: have Equals, so should have GetHashCode
Now that we offer to fix these problems, it seems like it might be nice to have versions of these diagnostics that explain that they cannot be fixed. For example, if a base type shadows
object.Equals
, then there's no way to override it in a derived type. It would be helpful if the descriptions explained why (and what?) refactoring was required.The text was updated successfully, but these errors were encountered: