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

False Positive Warning for IDE0079 Remove Unneccessary Suppression #47288

Closed
vsfeedback opened this issue Aug 31, 2020 · 8 comments · Fixed by #47819
Closed

False Positive Warning for IDE0079 Remove Unneccessary Suppression #47288

vsfeedback opened this issue Aug 31, 2020 · 8 comments · Fixed by #47819
Assignees
Labels
Area-IDE Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Feature Request Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:I'm somewhat annoyed. A fix would be nice] [regression] [worked-in:16.7]
I use the SuppressMessageAttribute to suppress certain Resharper warnings. Visual Studio 2019 16.8.0 preview 2 is incorrectly suggesting that these attributes can be removed because they are not used. In fact, they are being used by Resharper.

[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "For future use.")]

Would it be possible to check the category and not step on Resharper's SuppressMessage attributes?


Original Comments

Feedback Bot on 8/30/2020, 08:05 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

@gafter gafter added the Area-IDE label Sep 1, 2020
@jinujoseph jinujoseph added Bug Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Question and removed Bug labels Sep 8, 2020
@jinujoseph jinujoseph added this to the 16.8 milestone Sep 8, 2020
@mavasani
Copy link
Contributor

mavasani commented Sep 8, 2020

This is by design, and the analyzer has a configurable option to skip specific diagnostic IDs from analysis. You can specify the following in your .editorconfig file:

dotnet_remove_unnecessary_suppression_exclusions = none

[*.cs]

dotnet_remove_unnecessary_suppression_exclusions = ID1, ID2

Basically, your options are:

  1. Turn off IDE0079 for the entire project
  2. Exclude specific diagnostic IDs from IDE0079 analysis as above.

@mavasani
Copy link
Contributor

mavasani commented Sep 8, 2020

Would it be possible to check the category and not step on Resharper's SuppressMessage attributes?

Not really - suppress message attributes are meant for suppressing analyzer diagnostics. Any third party component that uses the same suppression mechanisms for suppressing their own custom reported issues is relying on an unsupported suppression mechanism. Adding such a custom exclusion for a specific category used by a particular third party extension is not scalable, as there could be numerous different extensions using their own category that would then request the same.

@mavasani mavasani added the Resolution-By Design The behavior reported in the issue matches the current design label Sep 8, 2020
@mavasani
Copy link
Contributor

mavasani commented Sep 8, 2020

Tag @sharwell to bring this up for IDE design meeting review, I have marked this tentatively as by design.

@JoeRobich
Copy link
Member

During this weeks design review it was decided to move forward on a proposal to implement category exclusion for these diagnostics in a manner akin to the dotnet_remove_unnecessary_suppression_exclusions setting.

@mavasani mavasani added Feature Request and removed Question Resolution-By Design The behavior reported in the issue matches the current design labels Sep 17, 2020
mavasani added a commit to mavasani/roslyn that referenced this issue Sep 17, 2020
@mavasani mavasani modified the milestones: 16.8, 16.8.P4 Sep 18, 2020
@mavasani
Copy link
Contributor

After #47819 is merged, you should be able to exclude entire category by setting the below editorconfig option:

[*.cs]
dotnet_remove_unnecessary_suppression_exclusions = category: ReSharper

@sharwell sharwell added the Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented label Sep 19, 2020
@sharwell sharwell modified the milestones: 16.8.P4, Next Sep 19, 2020
@dibarbet dibarbet modified the milestones: Next, 16.8.P4 Sep 21, 2020
@drvic10k
Copy link

drvic10k commented Mar 15, 2021

I think this not happening only for resharper's rules

[SuppressMessage("Microsoft.Maintainability", "CA1506", Justification = "By Design")] is marked as unneessary but when removed, build detects these errors

@sharwell
Copy link
Member

@drvic10k Can you file a new issue for that? It sounds like an unrelated issue.

@drvic10k
Copy link

@drvic10k Can you file a new issue for that? It sounds like an unrelated issue.

ok, created one here: #51884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Feature Request Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

8 participants