In a recent project I rellay nailed the code using FXCop. The goal was to eliminate all messages of FXCop.
After a short periode of time I already figure: no way! There are just a couple of cases, where I have to irgnore the messages of FXCop. Luckily there is an easy way to supress the messages of FXCop. Just open the context menu of the message and copy the message as SupresseMessage to the clipboard.
Next you can insert that at the appropriate position within your code, most likely as a method-attribute.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")]
OK, so now your’re good to go. The next run of FXCop should present you a lot less messages.
And if not? Something went wrong. Some little, very well hidden comment in the documentations says:
The ConditionalAttribute is applied to this class, specifying the preprocessing symbol “CODE_ANALYSIS” as the conditional symbol that determines whether the attribute call is included or omitted. If the symbol is defined, the attribute call is included; otherwise, the call is omitted.
OK. So opening up the project properties and adding the symbol CODE_ANALYSIS
helped a lot in getting the number of FXCop messages down.