Lint for C#

C#.NetCode AnalysisLint

C# Problem Overview


Is there a lint-like tool for C#? I've got the compiler to flag warnings-as-errors, and I've got Stylecop, but these only catch the most egregious errors. Are there any other must-have tools (especially for newbie C#ers like me) that point out probably-dumb things I'm doing?

C# Solutions


Solution 1 - C#

Tried FxCop? It's integrated into VS as "Code Analysis"

In the newer versions of Visual Studio, it is called "Microsoft Code Analysis" and can be downloaded from the Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.MicrosoftCodeAnalysis2017

Solution 2 - C#

Resharper performs a fair bit of static analysis as well as doing a ton of other useful things. Since version 8.0 analysis can run in command line mode. Currently I wouldn't code in C# without it.

As well as FxCop, Gendarme is another tool to look at (it is Mono's version of FxCop but they are different in approach and the errors that they actually find).

Solution 3 - C#

SonarLint (free, open source) is pretty sweet!

> SonarLint for Visual Studio is based on and benefits from the .NET Compiler Platform ("Roslyn") and its code analysis API to provide a fully-integrated user experience in Visual Studio 2015. SonarLint is free, open source, and available in the Visual Studio Gallery.

Solution 4 - C#

Gendarme for Mono is similar to FxCop

Solution 5 - C#

You can try .Net Reflector by Red-Gate, you can get it from here. Many useful plugins for .Net Reflector are available on CodePlex which you can get it from here.

Solution 6 - C#

This question already has an answer, but for reference...

You can try PVS-Studio. That's not free, but, IMHO, must have one. Quote from their site:

>PVS-Studio is a tool used to detect bugs in the source code of programs written in C, C++ and C#. > >PVS-Studio performs static code analysis and generates a report that helps a programmer find and fix bugs. PVS-Studio does a wide range of code checks; but it is especially useful to search for misprints and Copy-Paste errors. > >The analyzer is designed for developers who use Visual Studio.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKenView Question on Stackoverflow
Solution 1 - C#mmxView Answer on Stackoverflow
Solution 2 - C#Kris EricksonView Answer on Stackoverflow
Solution 3 - C#MrchiefView Answer on Stackoverflow
Solution 4 - C#Nathan KoopView Answer on Stackoverflow
Solution 5 - C#this. __curious_geekView Answer on Stackoverflow
Solution 6 - C#dimhotepusView Answer on Stackoverflow