The busy folks on the FxCop team have posted a new release, 1.312.  There’s 43 new rules and some of those rules look outstanding.  A couple of my favorites are the “Avoid unnecessary string creation” (which looks to see if you are creating extranious strings on the heap) and “Do not raise reserved exception types” (which ensures you don’t throw something like System.Exception directly).  The Read Me file discusses all the new stuff.

The team changed the custom rule SDK yet again, but the changes are for the better.  See the Read Me for all the changes.  Since many people are using the rules I developed for FxCop as part of my June 2004 and September 2004 Bugslayer columns, I updated all the rules I did to support FxCop 1.312, which you can download here.  Porting the rules to the new SDK interface wasn’t too bad.  In the near future, I’ll post an article here at the site which describes what’s necessary to do the porting.  If you have your own rules to port, take a look at the Empty Rule example in my code to see what’s different.

For rule writers, one major feature has been added to FxCop 1.312: when loading a rule that has a broken XML description, it finally tells you exactly which part of the XML is wrong!  In previous versions it was a complete trial and error process to find the error in your XML description.  Now FxCop tells you in the output window exactly what piece was wrong and why.  It’s a huge timesaver.  Thanks to the team for adding that.

If you have any ideas for rules, we’d love to hear about them!  Shoot me an email (john at this web site) or post in the comments.  The rules are fun to develop and if there are some good suggestions, I’ll write them.