Share via


Extended Design Guidelines Rules rule set for managed code

The Microsoft Extended Design Guideline Rules rule set expands on the basic design guideline rules to maximize the usability and maintainability issues that are reported. Extra emphasis is placed on naming guidelines. You should consider including this rule set if your project includes library code or if you want to enforce the highest standards for writing code that is easy to maintain.

The Extended Design Guideline Rules include all rules in the Basic Design Guideline Rules rule set, which includes the rules in the Managed Recommended Rules rule set.

The following table describes all the rules in the Microsoft Extended Design Guideline Rules rule set.

Rule Description
CA1001 Types that own disposable fields should be disposable
CA1009 Declare event handlers correctly
CA1016 Mark assemblies with AssemblyVersionAttribute
CA1033 Interface methods should be callable by child types
CA1049 Types that own native resources should be disposable
CA1060 Move P/Invokes to NativeMethods class
CA1061 Do not hide base class methods
CA1063 Implement IDisposable correctly
CA1065 Do not raise exceptions in unexpected locations
CA1301 Avoid duplicate accelerators
CA1400 P/Invoke entry points should exist
CA1401 P/Invokes should not be visible
CA1403 Auto layout types should not be COM visible
CA1404 Call GetLastError immediately after P/Invoke
CA1405 COM visible type base types should be COM visible
CA1410 COM registration methods should be matched
CA1415 Declare P/Invokes correctly
CA1821 Remove empty finalizers
CA1900 Value type fields should be portable
CA1901 P/Invoke declarations should be portable
CA2002 Do not lock on objects with weak identity
CA2100 Review SQL queries for security vulnerabilities
CA2101 Specify marshaling for P/Invoke string arguments
CA2108 Review declarative security on value types
CA2111 Pointers should not be visible
CA2112 Secured types should not expose fields
CA2114 Method security should be a superset of type
CA2116 APTCA methods should only call APTCA methods
CA2117 APTCA types should only extend APTCA base types
CA2122 Do not indirectly expose methods with link demands
CA2123 Override link demands should be identical to base
CA2124 Wrap vulnerable finally clauses in outer try
CA2126 Type link demands require inheritance demands
CA2131 Security critical types may not participate in type equivalence
CA2132 Default constructors must be at least as critical as base type default constructors
CA2133 Delegates must bind to methods with consistent transparency
CA2134 Methods must keep consistent transparency when overriding base methods
CA2137 Transparent methods must contain only verifiable IL
CA2138 Transparent methods must not call methods with the SuppressUnmanagedCodeSecurity attribute
CA2140 Transparent code must not reference security critical items
CA2141 Transparent methods must not satisfy LinkDemands
CA2146 Types must be at least as critical as their base types and interfaces
CA2147 Transparent methods may not use security asserts
CA2149 Transparent methods must not call into native code
CA2200 Rethrow to preserve stack details
CA2202 Do not dispose objects multiple times
CA2207 Initialize value type static fields inline
CA2212 Do not mark serviced components with WebMethod
CA2213 Disposable fields should be disposed
CA2214 Do not call overridable methods in constructors
CA2216 Disposable types should declare finalizer
CA2220 Finalizers should call base class finalizer
CA2229 Implement serialization constructors
CA2231 Overload operator equals on overriding ValueType.Equals
CA2232 Mark Windows Forms entry points with STAThread
CA2235 Mark all non-serializable fields
CA2236 Call base class methods on ISerializable types
CA2237 Mark ISerializable types with SerializableAttribute
CA2238 Implement serialization methods correctly
CA2240 Implement ISerializable correctly
CA2241 Provide correct arguments to formatting methods
CA2242 Test for NaN correctly
CA1000 Do not declare static members on generic types
CA1002 Do not expose generic lists
CA1003 Use generic event handler instances
CA1004 Generic methods should provide type parameter
CA1005 Avoid excessive parameters on generic types
CA1006 Do not nest generic types in member signatures
CA1007 Use generics where appropriate
CA1008 Enums should have zero value
CA1010 Collections should implement generic interface
CA1011 Consider passing base types as parameters
CA1012 Abstract types should not have constructors
CA1013 Overload operator equals on overloading add and subtract
CA1014 Mark assemblies with CLSCompliantAttribute
CA1017 Mark assemblies with ComVisibleAttribute
CA1018 Mark attributes with AttributeUsageAttribute
CA1019 Define accessors for attribute arguments
CA1023 Indexers should not be multidimensional
CA1024 Use properties where appropriate
CA1025 Replace repetitive arguments with params array
CA1026 Default parameters should not be used
CA1027 Mark enums with FlagsAttribute
CA1028 Enum storage should be Int32
CA1030 Use events where appropriate
CA1031 Do not catch general exception types
CA1032 Implement standard exception constructors
CA1034 Nested types should not be visible
CA1035 ICollection implementations have strongly typed members
CA1036 Override methods on comparable types
CA1038 Enumerators should be strongly typed
CA1039 Lists are strongly typed
CA1041 Provide ObsoleteAttribute message
CA1043 Use integral or string argument for indexers
CA1044 Properties should not be write only
CA1046 Do not overload operator equals on reference types
CA1047 Do not declare protected members in sealed types
CA1048 Do not declare virtual members in sealed types
CA1050 Declare types in namespaces
CA1051 Do not declare visible instance fields
CA1052 Static holder types should be sealed
CA1053 Static holder types should not have constructors
CA1054 URI parameters should not be strings
CA1055 URI return values should not be strings
CA1056 URI properties should not be strings
CA1057 String URI overloads call System.Uri overloads
CA1058 Types should not extend certain base types
CA1059 Members should not expose certain concrete types
CA1064 Exceptions should be public
CA1500 Variable names should not match field names
CA1502 Avoid excessive complexity
CA1708 Identifiers should differ by more than case
CA1716 Identifiers should not match keywords
CA1801 Review unused parameters
CA1804 Remove unused locals
CA1809 Avoid excessive locals
CA1810 Initialize reference type static fields inline
CA1811 Avoid uncalled private code
CA1812 Avoid uninstantiated internal classes
CA1813 Avoid unsealed attributes
CA1814 Prefer jagged arrays over multidimensional
CA1815 Override equals and operator equals on value types
CA1819 Properties should not return arrays
CA1820 Test for empty strings using string length
CA1822 Mark members as static
CA1823 Avoid unused private fields
CA2201 Do not raise reserved exception types
CA2205 Use managed equivalents of Win32 API
CA2208 Instantiate argument exceptions correctly
CA2211 Non-constant fields should not be visible
CA2217 Do not mark enums with FlagsAttribute
CA2219 Do not raise exceptions in exception clauses
CA2221 Finalizers should be protected
CA2222 Do not decrease inherited member visibility
CA2223 Members should differ by more than return type
CA2224 Override equals on overloading operator equals
CA2225 Operator overloads have named alternates
CA2226 Operators should have symmetrical overloads
CA2227 Collection properties should be read only
CA2230 Use params for variable arguments
CA2234 Pass System.Uri objects instead of strings
CA2239 Provide deserialization methods for optional fields
CA1020 Avoid namespaces with few types
CA1021 Avoid out parameters
CA1040 Avoid empty interfaces
CA1045 Do not pass types by reference
CA1062 Validate arguments of public methods
CA1501 Avoid excessive inheritance
CA1504 Review misleading field names
CA1505 Avoid unmaintainable code
CA1506 Avoid excessive class coupling
CA1700 Do not name enum values 'Reserved'
CA1701 Resource string compound words should be cased correctly
CA1702 Compound words should be cased correctly
CA1703 Resource strings should be spelled correctly
CA1704 Identifiers should be spelled correctly
CA1707 Identifiers should not contain underscores
CA1709 Identifiers should be cased correctly
CA1710 Identifiers should have correct suffix
CA1711 Identifiers should not have incorrect suffix
CA1712 Do not prefix enum values with type name
CA1713 Events should not have before or after prefix
CA1714 Flags enums should have plural names
CA1715 Identifiers should have correct prefix
CA1717 Only FlagsAttribute enums should have plural names
CA1719 Parameter names should not match member names
CA1720 Identifiers should not contain type names
CA1721 Property names should not match get methods
CA1722 Identifiers should not have incorrect prefix
CA1724 Type Names Should Not Match Namespaces
CA1725 Parameter names should match base declaration
CA1726 Use preferred terms
CA2204 Literals should be spelled correctly