Blog Post RSS ?

Blogs » .NET » FxCop
 

FxCop

by 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!

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Ping.fm
  • Twitthis

No related posts.

This post has 5 responses so far

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Follow SitePoint on...