Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / All-Topics

Four C# Code Analyzers That Are Worth Your Time

3.91/5 (6 votes)
9 Jun 2016CPOL2 min read 23.2K  
Four C# code analyzers that are worth your time

With the advent of .NET Compiler Platform (code-named “Roslyn”), it became possible to build code analyzers for languages like C# with ease. In the past, only big companies like JetBrains or DevExpress with a lot of resources could build a code analyzer, because building it involved writing your own compiler for that purpose. Now the .NET Compiler Platform provides developers with a set of APIs to query the compiler and interact with it. In this post, I'm going to introduce four code analyzers that I happen to use, if you think some other important analyzer exists that is worth mentioning, please let me know in the comments section.

What is Code Analyzer?

In its simplest form, code analyzers are a set of tools that can analyze your code, and based on their rulesets, tell you what part of your code has a potential problem, and can get better. In this case, some of them can also provide you with an automatic fix for that problem.

Refactoring Essentials

Image 1

Refactoring Essentials constantly gets updated by an active community, it works with C# and VB, and provide a set of features that you can see here.

Code Cracker

Image 2

Code Cracker is another amazing code analyzer for C# and VB, it also has an active community around it that only gets better as the set of rules and fixes grows.

StyleCop Analyzers

Another great analyzer to have is StyleCop Analyzer for the .NET Compiler Platform, you don't have to use the old stuff anymore, this analyzer does its magic for you on the fly.

SonarLint

Image 3

SonarLint is a great analyzer, the thing that set it apart from others, is that it has a connected mode, which allows you to connect to a server and automatically updates your rulesets for the solution. It also has an active community. You can install it as an Visual Studio extension.

As a minor note to those of you who don't use Visual Studio 2015, if you want to use these features, you need to either install VS 2015, or install the roslyn compiler as a nuget package. What you need to install can be found here and here and here!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)