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

Missing rule ID entries in Ruleset Editor when opening ruleset added to new SDK style project #3573

Open
mavasani opened this Issue May 24, 2018 · 4 comments

Comments

Projects
None yet
5 participants
@mavasani
Contributor

mavasani commented May 24, 2018

I am using the latest internal VS dogfood build, but this repros on 15.7 as well.

Repro Steps (Repro 1):

  1. Create a new .NET framework class library project (old project system)
  2. Create an empty ruleset file named MyRules.ruleset at the root of project with following contents:
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="My Rules" Description="" ToolsVersion="15.0">
</RuleSet>
  1. Add the following property to the project file to add ruleset to the project: <CodeAnalysisRuleSet>MyRules.ruleset</CodeAnalysisRuleSet>

  2. Add a NuGet package reference to latest stable FxCopAnalyzers package

  3. Open MyRules.ruleset in the ruleset editor by executing Solution Explorer -> Project Node -> References -> Analyzers -> Open Active Ruleset

  4. Search CA1034 in the search box in the ruleset editor and confirm you get 2 entries, one for Managed Binary Analysis and one for Microsoft.CodeQuality.Analyzers:
    image

  5. Repeat the above steps for a new SDK style project .NET standard class library project.

Expected
Searching CA1034 shows same 2 entries for SDK style project, that were seen in step 6 for old style project.

Actual
No matching entries
image

@mavasani mavasani added the Bug label May 24, 2018

@mavasani

This comment has been minimized.

Contributor

mavasani commented May 24, 2018

Repro Steps (Repro 2):

  1. Create a new solution with one SDK style .NET standard class library project and one old style .NET framework class library project
  2. Create MyRules.ruleset (with same contents as in Repro 1) at the root of the solution and add it as an existing Solution item to this solution.
  3. Add the following property to both the project files to add same ruleset to the projects: <CodeAnalysisRuleSet>..\MyRules.ruleset</CodeAnalysisRuleSet>
  4. Add a NuGet package reference to latest stable FxCopAnalyzers package to both the projects
  5. Double click on the MyRules.ruleset in the solution items to open it in the ruleset editor
  6. Search CA1034 in the search box in the ruleset editor:

Expected
Searching CA1034 shows same 2 entries as were seen in step 6 for Repro 1.

Actual
Only one matching entry, which is for Managed Binary Analysis (old FxCop), with value None.
image

User feels CA1034 analyzer in FxCopAnalyzers package is suppressed, but actually it is still running and you will see CA1034 diagnostics reported by the analyzer in the error list. Checking/Un-checking the CA1034 checkbox for Managed Binary Analysis has no effect on the FxCop analyzer. The only workaround for the user is to manually edit the ruleset file to add the following entry to suppress this rule from the analyzer package:

<Rules AnalyzerId="Microsoft.CodeQuality.Analyzers" RuleNamespace="Microsoft.CodeQuality.Analyzers">
    <Rule Id="CA1034" Action="None" />
</Rules>
@Pilchie

This comment has been minimized.

Member

Pilchie commented May 24, 2018

@mavasani - any idea what's going wrong in the new project system to trigger this?

@Pilchie Pilchie added this to the 16.0 milestone May 24, 2018

@mavasani

This comment has been minimized.

Contributor

mavasani commented May 24, 2018

I recall @tmeschter fixed a bunch of stuff to get this to even work for the new project system. The API tying up the ruleset editor to Roslyn to get the correct entries is this one: http://source.roslyn.io/#Microsoft.VisualStudio.LanguageServices/Implementation/Diagnostics/IVisualStudioDiagnosticAnalyzerService.cs,20. Probably run it through the debugger to see why we are not receiving the supported analyzer rule IDs.

@curia-damiano

This comment has been minimized.

curia-damiano commented May 25, 2018

+1

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