Programming
Article
By Philip Miseldine

FxCop

By Philip Miseldine

This, to me, is the best tool for .NET so far. And, I’m including nDoc here :)

FxCop is a code inspector that checks assemblies for conformance to .NET Framework design guidelines. And, it really works. Kind of.

The program works using introspection and a flexible rule engine to decompile and analyse managed assemblies and show you where your code is breaking the guidelines.

As a test, I checked out my own blog code with FxCop. The process takes just seconds, and a whole list of bad practises were presented. I actually learnt from the analysis. For example, I used a sloppy:


if (bodyText == "")

FxCop has told me to check for empty strings using:


if (bodyText.Length() == 0)

as its far more efficient. Now, that’s cool.

Many of the problems it highlighted were actually produced by Visual Studio .NET, such as :

“Make ‘CheckBox1’ private or internal and provide a public or protected property to access it.”

Taking those errors to one side however, you can really get a good idea of how to improve your coding. What a great tool.

FxCop is Microsoft produced, and is free to download.

thanks to Zak for the original link!

Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account