" />

Catch the obscure problems in your program before you release it – Use Visual Studio’s inbuilt ‘Code Analysis’ Tool

  • Home
  • coding
  • Catch the obscure problems in your program before you release it – Use Visual Studio’s inbuilt ‘Code Analysis’ Tool

Every developer should maintain his/her code quality and to do so the first step can be to review code by self with the help of Code Analysis tool. Code Analysis will help to improve your code quality and avoid common problems which are not trapped in compilation.

There are many different free and commercial tools available for the Code Analysis for both managed and unmanaged source code. But I am using the Code Analysis tool which as it is inbuilt with Visual Studio.


Visual Studio Code analysis tool is a static analyser, which means it depends completely on source code and no need to execute our application.

This tool warns developers about possible errors in the source code which are not handled yet.

Major errors developer should look for are using uninitialized memory, buffer overruns, dereferencing a copy of a null pointer, Array-new scalar-delete mismatch, memory leaks and resource leaks.


This tool supports both managed and unmanaged source code.


Code Analysis Menu

Code Analysis Menu

You can either run Code Analysis for complete solution or for single project from a solution.


Project Properties Menu

Project Properties Menu

Here you can set the desired rule set for Code Analysis. You can also create your custom Code Analysis rule set.


Code Analysis Results
Code Analysis Result

Once code analysis is completed warnings will be displayed in the Code Analysis window. Developer needs to just click on the a warning to go to the exact line of code having warning and resolve it with the help of description provided in the window. You can copy all the warnings to a text file for future reference.

Links for reference:





Video tutorial from Microsoft:



Author : Vijay S.


ProtoTech Solutions is a custom software development company with skills in engineering graphics, specifically focused in the areas of CAD/CAM/CAE and Graphics. My role in the company is to look after everything, and specially the work which is most important or critical for that day.

View all posts by


You must be logged in to post a comment.