Experience with FxCop

Sunday, July 22, 2007 9:40:28 PM (Romance Standard Time, UTC+01:00)
On my current project (one developer, total of six months, one month left) I have from the very beginning been using the static analysis tool "FxCop". The tool is not Open Source, but freeware from Microsoft, so it is somewhat in between being commercial and non-commercial.

Until now I have experienced both benefits and drawbacks. FxCop actually catches real bugs, albeit not any that I commit very often. Until now it has raised a warning 3 times for one specific kind of error in my code: that I forgot to call Dispose() on a member variable implementing IDisposable. Giving me this warning have probably saved me about 3 hours of debugging.

One major drawback is that it takes quite some time to run FxCop (almost as much time as a recompile), so I will not run it on every compile, meaning that I sometimes forget to run it - that's why I know how long time it takes to debug a case of a forgotten call to Dispose() :-)

The other major drawback is that FxCop will give me an awful lot of warnings about code that it finds suspicious; warnings that I consider to be just silly. In this project I have used some time to rewrite the code to prevent FxCop from giving warnings. Otherwise I could have annotated the code to make the tool suppress just these warnings for just these places in the code. I guess that I have used around 6 hours on the rewriting. And I still have around 10 warnings that I haven't yet taken time to eliminate.

In conclusion I must at this point say that FxCop does not seem to be of real benefit for me.
By Lars Thorup