
Follow the Rules with FxCop #65
Chapter 7, Help and Research
|
257
HACK
The Properties tab also shows you where to find help for the violation and
the rule file used in the analysis. When I mentioned earlier that FxCop is a
good learning tool, it was because of the information provided in this tab. As
you can see, the tool provides insight as to why the message was generated.
Fix a Message—and Watch It Disappear
Great, you’ve written a class library that you think is rock solid, but then
you run FxCop on it, which generates more issues than you care to admit.
Chances are you’ll choose to ignore some messages (for various reasons),
but you’ll want to take care of others. The good news is that FxCop identi-
fies exactly where the issues are, so most of the work of tracking down the
violations has already been done for you. All you have to do is fix the prob-
lem and recompile your assembly.
Previous versions of FxCop would keep a lock on the .NET assembly you
were trying to analyze; thus, when you went to modify your code and
recompile the assembly with FxCop still open, you would get an Access
Denied error. To get around this, you had to shut down FxCop, recompile
your code, then open FxCop again. Luckily, Version 1.30 and above of
Figure 7-29. Properties tab for a given issue in FxCap