Static Code Analysis - Part 2 - Run and View Results
[NOTE: Still have not resolved the image problem. Please log into Team System Rocks! to be able to see the images.]
Now that you have turned on static code analysis (see my previous post here), its time to use it. Right-click on your project in Solution Explorer and select Rebuild, to rebuild the project. While the project is being built, static code analysis is being run against the code. The project should build successfully. Once the project is finished building, open the Error List window to view the results of the static code analysis:
As you can see, the static code analysis threw six different warnings for possible violations. Some of these warnings may or may not make sense to you. To get a better understanding of a warning, right-click on the warning, and select Show Error Help. This will open a help file with a description of the rule, suggestions for how to fix the rule and when to exclude the warning, and finally, some example code to try and help you understand the rule. In the following image, I selected the CA2209 warning (the first one), right-clicked on it, and selected Show Error Help:
Also, if you double-click a warning, you will be taken to the offending code so you can fix the violation.