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

Add more nuanced versions of CA2224 and CA2218 #749

Open
amcasey opened this issue Dec 8, 2015 · 2 comments
Open

Add more nuanced versions of CA2224 and CA2218 #749

amcasey opened this issue Dec 8, 2015 · 2 comments
Labels
Feature Request FxCop-Port help wanted The issue is up-for-grabs, and can be claimed by commenting
Milestone

Comments

@amcasey
Copy link
Member

amcasey commented Dec 8, 2015

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.

@mavasani mavasani added this to the Unknown milestone Apr 15, 2017
@sharwell sharwell added help wanted The issue is up-for-grabs, and can be claimed by commenting and removed Up for Grabs labels Aug 1, 2019
@Evangelink
Copy link
Member

@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?

@amcasey
Copy link
Member Author

amcasey commented Jun 15, 2020

@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 mavasani changed the title Add more nuanced versions of CS2224 and CA2218 Add more nuanced versions of CA2224 and CA2218 Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request FxCop-Port help wanted The issue is up-for-grabs, and can be claimed by commenting
Projects
None yet
Development

No branches or pull requests

4 participants