Open mavasani opened 6 years ago
Repro Steps (Repro 2):
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.<CodeAnalysisRuleSet>..\MyRules.ruleset</CodeAnalysisRuleSet>
MyRules.ruleset
in the solution items to open it in the ruleset editorCA1034
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
.
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>
@mavasani - any idea what's going wrong in the new project system to trigger this?
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.
+1
If you don't have a legacy csproj in your solution, is there a way to get any PackageReference analyzers to show up, or projects to show up in the 'Project:' dropdown?
I'm still seeing this issue in VS2019.... my .ruleset file sets Action to None for rules I don't care for and they still get flagged in Error list regardless. E.g.
<?xml version="1.0" encoding="utf-8"?>
Is there an ETA for a fix?
I am using the latest internal VS dogfood build, but this repros on 15.7 as well.
Repro Steps (Repro 1):
Create a new .NET framework class library project (old project system)
Create an empty ruleset file named
MyRules.ruleset
at the root of project with following contents:Add the following property to the project file to add ruleset to the project:
<CodeAnalysisRuleSet>MyRules.ruleset</CodeAnalysisRuleSet>
Add a NuGet package reference to latest stable FxCopAnalyzers package
Open
MyRules.ruleset
in the ruleset editor by executingSolution Explorer -> Project Node -> References -> Analyzers -> Open Active Ruleset
Search![image](https://user-images.githubusercontent.com/10605811/40498630-6468692e-5f34-11e8-99c8-d054e5e750b7.png)
CA1034
in the search box in the ruleset editor and confirm you get 2 entries, one forManaged Binary Analysis
and one forMicrosoft.CodeQuality.Analyzers
: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](https://user-images.githubusercontent.com/10605811/40499051-a09c450e-5f35-11e8-9e8d-c73375359a8e.png)