Skip to content

Update SA1119 (StatementMustNotUseUnnecessaryParenthesis) for new API restrictions #929

@sharwell

Description

@sharwell

SA1119 relies on a hidden diagnostic which is not included in SupportedDiagnostics to gray out unnecessary parentheses. Starting with the RC3 release of Roslyn, the pattern used here is no longer supported. This analyzer needs to be updated to the following pattern to make it compatible with (presumably) upcoming releases of Visual Studio 2015:

  1. Include the hidden diagnostic in the SupportedDiagnostics
  2. Enable the hidden diagnostic by default
  3. Update Initialize to only register a compilation start action. In the callback, check to see if SA1119 is not suppressed before registering other callbacks. Now that the parentheses diagnostic is always enabled, this analyzer will always be active during builds. We can eliminate essentially all overhead from this by conditionally registering its callbacks in the compilation start handler.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions