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 analyzer/fixer to recommend switching global suppression target string from legacy FxCop format to Roslyn format #44362

Closed
mavasani opened this issue May 18, 2020 · 1 comment · Fixed by #44440

Comments

@mavasani
Copy link
Contributor

Global suppressions allow suppressing analyzer diagnostics on specific symbols via an attribute that requires a "Target" string argument that encodes the fully qualified name of the symbol. This target can be specified in one of the following formats:

  1. Roslyn's documentation comment ID format, which has a ~ prefix followed by the symbol's documentation comment ID. This is the format of suppressions generated by the code fixes/light bulb in Visual Studio
  2. Legacy FxCop's custom format for post-build FxCopCmd.exe based suppressions.

Roslyn's format is the officially supported and recommended format for global suppression target. Legacy FxCop's format is supported only for backwards compatibility, and recently has shown performance issues in the IDE typing scenarios while attempting to decode the target. See https://developercommunity.visualstudio.com/content/problem/1026087/slow-ide-after-edits.html for an example typing trace dominated by attempting to decode a global suppression in legacy FxCop format.

This issue tracks adding a new analyzer/code fix to detect global suppressions in legacy FxCop format, and offering a code fix to convert them to the Roslyn's format.

@mavasani mavasani added this to the 16.7.P2 milestone May 18, 2020
@mavasani mavasani self-assigned this May 18, 2020
mavasani added a commit to mavasani/roslyn that referenced this issue May 20, 2020
…lyn doc comment ID format suppressions

Additionally, I have also addressed dotnet#44343 to avoid unnecessary list allocations in SuppressMessage TargetResolver

Fixes dotnet#44362
Fixes dotnet#44343
@mavasani mavasani modified the milestones: 16.7.P2, 16.7.P3 May 27, 2020
@softworkz
Copy link

This analyzer has a bug. It shouldn't report cases where

Scope = "namespaceanddescendants"

because afaik, there doesn't exist a "Roslyn format" for the "Target" attribute in this case.

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

Successfully merging a pull request may close this issue.

2 participants