Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » FAQ » Rules   (RSS)

FAQ: What exception should I throw instead of the reserved exceptions that DoNotRaiseReservedExceptionTypes warns against?

Throwing a general exception type such as System.Exception or System.SystemException in a library or Framework forces consumers to catch all exceptions, including unknown exceptions that they do not know how to handle (see FAQ: Why does FxCop warn against

FAQ: How do I fix a violation of MovePInvokesToNativeMethodsClass?

MovePInvokesToNativeMethodsClass fires on P/Invokes (ie methods marked with DllImport) that are not members of one of the following classes; NativeMethods, SafeNativeMethods or UnsafeNativeMethods. For example, the following sample fires this warning.

FAQ: Why does FxCop warn against catch(Exception)? - Part 3 [Nick Guerrera]

This is the third installment in a three-part series on why FxCop warns against catch(Exception): FAQ: Why does FxCop warn against catch(Exception)? - Part 1 FAQ: Why does FxCop warn against catch(Exception)? - Part 2 FAQ: Why does FxCop warn against

FAQ: Why does FxCop warn against catch(Exception)? - Part 2 [Nick Guerrera]

This is the second installment in a three-part series on why FxCop warns against catch(Exception): FAQ: Why does FxCop warn against catch(Exception)? - Part 1 FAQ: Why does FxCop warn against catch(Exception)? - Part 2 FAQ: Why does FxCop warn against

FAQ: Why does FxCop warn against catch(Exception)? - Part 1 [Nick Guerrera]

This is the first installment in a three-part series on why FxCop warns against catch(Exception): FAQ: Why does FxCop warn against catch(Exception)? - Part 1 FAQ: Why does FxCop warn against catch(Exception)? - Part 2 FAQ: Why does FxCop warn against

FAQ: Why does DoNotExposeGenericLists recommend that I expose Collection<T> instead of List<T>? [David Kean]

DoNotExposeGenericLists fires when I publicly expose List<T> via a field, method, property, or parameter. Why? Although Krzysztof briefly touched on this last year , we wanted to expand on this a little through the use of examples. The first reason

FAQ: Why do some sources recommend extending ApplicationException while FxCop does not? [Michael Fanning, David Kean]

TypesShouldNotExtendCertainBaseTypes fires on types that derive from ApplicationException and DoNotRaiseReservedExceptionTypes on members that throw ApplicationException. Why? There are several outdated documents floating around on the web (some orginally

FAQ: How do I indicate to DoNotDeclareReadOnlyMutableReferenceTypes that a type is immutable? [David Kean]

DoNotDeclareReadOnlyMutableReferenceTypes is a rule that checks for visible read-only fields that are mutable reference types (classes). A mutable type is a type whose instance data can be changed once it has been constructed. For example, the following
 
Page view tracker