Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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).

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.

Gendarme for Mono is similar to FxCop

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top