Live code analysis rules and code fixes addressing API design, performance, security, and best practices for C# and Visual Basic.
This is a preview version of the extension. You must have Visual Studio 2019 version 16.0 or later
We’ve rebuilt the most popular 100+ FxCop rules as live analyzers to help you detect problems in your code and make it super easy for you to fix them on the spot with quick fixes. This extension gives you the same great code analysis as before with FXCop but now the analysis is live as-you-type and has quick-fixes.
100+ live diagnostics for API design, performance, security, and best practices for C# and Visual Basic.
Quick fixes for applicable diagnostics (using Ctrl+.).
Diagnostics appear in the editor, Error List, and scroll bar.
Place your cursor in the span of the squiggle/dotted line and press “Ctrl+.” to trigger the lightbulb menu. From the lightbulb, you will see all available quick actions.
Configure a rule on/off and change severity – in the Solution Explorer, navigate to the “References” node under your project. Right-click on the Analyzers sub-node and select “Open Active Rule Set”. Using the GUI, you can set the severity of any rule to “None”, “Info”, “Warning”, or “Error”. Note: If you have a .NET Core project, you must manually add a file name “ProjectName.ruleset”.
Suppress a rule – place your cursor inside the span of the squiggle and press “Ctrl+.” to trigger the lightbulb menu. From there you should see the option to Suppress in file (via #pragma) or via a global Suppression file. Alternatively, you can go to the Error List and right-click to suppress.
Bulk-suppression / Baselining – To suppress all active issues, you can select all issues in the Error List, right-click, and navigate to “Suppress” or you can right-click on your project in the Solution Explorer and navigate to Analyze > Run Code Analysis and Suppress Active Issues.
Suggestion (“Info”) Severity Level
Code suggestion manifests as a gray, dotted underline in the editor and represents a hint or best practice (that isn’t necessarily an Error or Warning).
If you are already using the equivalent NuGet package (Microsoft.CodeAnalysis.FXCopAnalyzers), then installing this extension will cause issues (see issue here). Please install the latest NuGet package rather than the extension if this is the case.