This blog compares the Code Analysis warnings and errors generated by Visual Studio 2008 and Visual Studio 2010.
Warning / Error
Number
Description
Visual Studio 2008 Team System
Visual Studio 2010 Premium
CA0001
An exception was raised within managed code analysis tool that does not indicate an expected error condition.
Yes
CA0051
No rules were selected.
CA0052
No targets were selected to analyze.
CA0053
Rule assembly could not be loaded.
CA0054
A custom rule assembly has invalid XML resources.
CA0055
Could not load file:<path>
CA0056
A project file has an incorrect version of the analysis tool.
CA0057
Violations cannot be mapped to the current set of targets and rules.
CA0058
Unable to load assemblies referenced.
CA0059
Command line switch error.
CA0060
Unable to load assemblies referenced indirectly.
CA0061
The rule 'RuleId' referenced in rule set 'RuleSetName' could not be found.
-
CA0062
The rule 'RuleId' could not be found.
CA0063
Failed to load rule set file or one of its dependent rule set files.
CA0064
No analysis was performed because the specified rule set did not contain any FxCop rules.
CA0065
Unsupported metadata construct: Type 'TypeName' contains both a property and a field with the same name 'PropertyFieldName'
CA0066
CA0067
Directory not found.
CA0068
Debug information could not be found for target assembly 'AssemblyName'.
CA0069
UsingAlternatePlatform. FrameworkVersion1 could not be found. Using FrameworkVersion2 instead. For best analysis results please ensure that the correct .NET Framework is installed.
CA0070
Unable to analyze permission attributes
CA0501
Unable to read output report.
CA0502
Unsupported language.
CA0503
Additional warnings cannot be displayed.
CA0504
Rule directory was ignored because it does not exist
CA0505
The property is deprectated. Use the superceding property
CA1000
Do not declare static members on generic types
CA1001
Types that own disposable fields should be disposable
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
CA1009
Declare event handlers correctly
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
CA1016
Mark assemblies with AssemblyVersionAttribute
CA1017
Mark assemblies with ComVisibleAttribute
CA1018
Mark attributes with AttributeUsageAttribute
CA1019
Define accessors for attribute arguments
CA1020
Avoid namespaces with few types
CA1021
Avoid out parameters
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
CA1033
Interface methods should be callable by child types
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
CA1040
Avoid empty interfaces
CA1041
Provide ObsoleteAttribute message
CA1043
Use integral or string argument for indexers
CA1044
Properties should not be write only
CA1045
Do not pass types by reference
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
CA1049
Types that own native resources should be disposable
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
CA1060
Move P/Invokes to NativeMethods class
CA1061
Do not hide base class methods
CA1062
Validate arguments of public methods
CA1063
Implement IDisposable correctly
CA1064
Exceptions should be public
CA1065
Do not raise exceptions in unexpected locations
CA1300
Specify MessageBoxOptions
CA1301
Avoid duplicate accelerators
CA1302
Do not hardcode locale specific strings
CA1303
Do not pass literals as localized parameters
CA1304
Specify CultureInfo
CA1305
Specify IFormatProvider
CA1306
Set locale for data types
CA1307
Specify StringComparison
CA1308
Normalize strings to uppercase
CA1309
Use ordinal StringComparison
CA1400
P/Invoke entry points should exist
CA1401
P/Invokes should not be visible
CA1402
Avoid overloads in COM visible interfaces
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
CA1406
Avoid Int64 arguments for Visual Basic 6 clients
CA1407
Avoid static members in COM visible types
CA1408
Do not use AutoDual ClassInterfaceType
CA1409
Com visible types should be creatable
CA1410
COM registration methods should be matched
CA1411
COM registration methods should not be visible
CA1412
Mark ComSource interfaces as IDispatch
CA1413
Avoid non-public fields in COM visible value types
CA1414
Mark boolean P/Invoke arguments with MarshalAs
CA1415
Declare P/Invokes correctly
CA1500
Variable names should not match field names
CA1501
Avoid excessive inheritance
CA1502
Avoid excessive complexity
CA1504
Review misleading field names
CA1505
Avoid unmaintainable code
CA1506
Avoid excessive class coupling
CA1600
Do not use idle process priority
CA1601
Do not use timers that prevent power state changes
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
CA1708
Identifiers should differ by more than case
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
CA1716
Identifiers should not match keywords
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
CA1800
Do not cast unnecessarily
CA1801
Review unused parameters
CA1802
Use literals where appropriate
CA1804
Remove unused locals
CA1805
Do not initialize unnecessarily
No
CA1806
Do not ignore method results
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
CA1816
Call GC.SuppressFinalize correctly
CA1819
Properties should not return arrays
CA1820
Test for empty strings using string length
CA1821
Remove empty finalizers
CA1822
Mark members as static
CA1823
Avoid unused private fields
CA1824
Mark assemblies with NeutralResourcesLanguageAttribute
CA1900
Value type fields should be portable
CA1901
P/Invoke declarations should be portable
CA1903
Use only API from targeted framework
CA2000
Dispose objects before losing scope
CA2001
Avoid calling problematic methods
CA2002
Do not lock on objects with weak identity
CA2003
Do not treat fibers as threads
CA2004
Remove calls to GC.KeepAlive
CA2006
Use SafeHandle to encapsulate native resources
CA2100
Review SQL queries for security vulnerabilities
CA2101
Specify marshaling for P/Invoke string arguments
CA2102
Catch non-CLSCompliant exceptions in general handlers
CA2103
Review imperative security
CA2104
Do not declare read only mutable reference types
CA2105
Array fields should not be read only
CA2106
Secure asserts
CA2107
Review deny and permit only usage
CA2108
Review declarative security on value types
CA2109
Review visible event handlers
CA2111
Pointers should not be visible
CA2112
Secured types should not expose fields
CA2114
Method security should be a superset of type
CA2115
Call GC.KeepAlive when using native resources
CA2116
APTCA methods should only call APTCA methods
CA2117
APTCA types should only extend APTCA base types
CA2118
Review SuppressUnmanagedCodeSecurityAttribute usage
CA2119
Seal methods that satisfy private interfaces
CA2120
Secure serialization constructors
CA2121
Static constructors should be private
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
CA2127
Security transparent assemblies should not contain security critical code
CA2128
Security transparent code should not assert
CA2129
Security transparent code should not reference non-public security critical members
CA2130
Security critical constants should be transparent
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
CA2135
Level 2 assemblies should not contain LinkDemands
CA2136
Members should not have conflicting transparency annotations
CA2137
Transparent methods must contain only verifiable IL
CA2138
Transparent methods must not call methods with the SuppressUnmanagedCodeSecurity attribute
CA2139
Transparent methods may not use the HandleProcessCorruptingExceptions attribute
CA2140
Transparent code must not reference security critical items
CA2141
Transparent methods must not satisfy LinkDemands
CA2142
Transparent code should not be protected with LinkDemands
CA2143
Transparent methods should not use security demands
CA2144
Transparent code should not load assemblies from byte arrays
CA2145
Transparent methods should not be decorated with the SuppressUnmanagedCodeSecurityAttribute
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 native code
CA2200
Rethrow to preserve stack details
CA2201
Do not raise reserved exception types
CA2202
Do not dispose objects multiple times
CA2204
Literals should be spelled correctly
CA2205
Use managed equivalents of Win32 API
CA2207
Initialize value type static fields inline
CA2208
Instantiate argument exceptions correctly
CA2210
Assemblies should have valid strong names
CA2211
Non-constant fields should not be visible
CA2212
Do not mark serviced components with WebMethod
CA2213
Disposable fields should be disposed
CA2214
Do not call overridable methods in constructors
CA2215
Dispose methods should call base class dispose
CA2216
Disposable types should declare finalizer
CA2217
Do not mark enums with FlagsAttribute
CA2218
Override GetHashCode on overriding Equals
CA2219
Do not raise exceptions in exception clauses
CA2220
Finalizers should call base class finalizer
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
CA2228
Do not ship unreleased resource formats
CA2229
Implement serialization constructors
CA2230
Use params for variable arguments
CA2231
Overload operator equals on overriding ValueType.Equals
CA2232
Mark Windows Forms entry points with STAThread
CA2233
Operations should not overflow
CA2234
Pass System.Uri objects instead of strings
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
CA2239
Provide deserialization methods for optional fields
CA2240
Implement ISerializable correctly
CA2241
Provide correct arguments to formatting methods
CA2242
Test for NaN correctly
CA2243
Attribute string literals should parse correctly
No changes between Visual Studio 2008 and Visual Studio 2010.
Visual Studio Team System 2008
0x0
No errors
0x1
Analysis error
0x2
Rule exceptions
0x4
Project load error
0x8
Assembly load error
0x10
Rule library load error
0x20
Import report load error
0x40
Output error
0x80
Command line switch error
0x100
Initialization error
0x200
Assembly references error
0x400
BuildBreakingMessage
0x1000000
Unknown error
C6001
using uninitialized memory <variable>
C6011
dereferencing NULL pointer <name>
C6029
possible buffer overrun in call to <function>: use of unchecked value
C6031
return value ignored: <function> could return unexpected value
C6053
call to <function> may not zero-terminate string <variable>
C6054
string <variable> may not be zero-terminated
C6057
buffer overrun due to number of characters/number of bytes mismatch in call to <function>
C6059
Incorrect length parameter in call to <function>. Pass the number of remaining characters, not the buffer size of <variable>
C6063
missing string argument to <function> corresponding to conversion specifier <number>
C6064
missing integer argument to <function> corresponding to conversion specifier <number>
C6066
non-pointer passed as parameter <number> when pointer is required in call to <function>
C6067
parameter <number> in call to <function> must be the address of the string
C6200
index <name> is out of valid index range <min> to <max> for non-stack buffer <variable>
C6201
buffer overrun for <variable>, which is possibly stack allocated: index <name> is out of valid index range <min> to <max>
C6202
buffer overrun for <variable>, which is possibly stack allocated, in call to <function>: length <size> exceeds buffer size <max>
C6203
buffer overrun for buffer <variable> in call to <function>: length <size> exceeds buffer size
C6204
possible buffer overrun in call to <function>: use of unchecked parameter <variable>
C6209
using 'sizeof<variable1>' as parameter <number> in call to <function> where <variable2> may be an array of wide characters, did you intend to use character count rather than byte count?
C6211
Leaking memory <pointer> due to an exception. Consider using a local catch block to clean up memory
C6214
cast between semantically different integer types: HRESULT to a Boolean type
C6215
cast between semantically different integer types: a Boolean type to HRESULT
C6216
compiler-inserted cast between semantically different integral types: a Boolean type to HRESULT
C6217
Implicit cast between semantically different integer types: testing HRESULT with 'not'. Consider using SUCCEEDED or FAILED macro instead
C6219
Implicit cast between semantically different integer types: comparing HRESULT to 1 or TRUE. Consider using SUCCEEDED or FAILED macro instead
C6220
warning C6220 - Implicit cast between semantically different integer types: comparing HRESULT to -1. Consider using SUCCEEDED or FAILED macro instead
C6221
Implicit cast between semantically different integer types: comparing HRESULT to an integer. Consider using SUCCEEDED or FAILED macros instead
C6225
Implicit cast between semantically different integer types: assigning 1 or TRUE to HRESULT. Consider using S_FALSE instead
C6226
Implicit cast between semantically different integer types: assigning -1 to HRESULT. Consider using E_FAIL instead
C6230
implicit cast between semantically different integer types: using HRESULT in a Boolean context
C6235
(<non-zero constant> || <expression>) is always a non-zero constant
C6236
(<expression> || <non-zero constant>) is always a non-zero constant
C6237
(<zero> && <expression>) is always zero. <expression> is never evaluated and may have side effects
C6239
(<non-zero constant> && <expression>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator?
C6240
(<expression> && <non-zero constant>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator?
C6242
A jump out of this try-block forces local unwind. Incurs severe performance penalty
C6244
local declaration of <variable> hides previous declaration at <line> of <file>
C6246
Local declaration of <variable> hides declaration of same name in outer scope. Additional Information: See previous declaration at <location>.
C6248
setting a SECURITY_DESCRIPTOR’s DACL to NULL will result in an unprotected object
C6250
Calling <function> VirtualFree without the MEM_RELEASE flag may free memory but not address descriptors (VADs); results in address space leaks
C6255
_alloca indicates failure by raising a stack overflow exception. Consider using _alloca_s instead
C6258
using TerminateThread does not allow proper thread clean up
C6259
labeled code is unreachable: (<expression> & <constant>) in switch-expr cannot evaluate to <case-label>
C6260
sizeof * sizeof is almost always wrong, did you intend to use a character count or a byte count?
C6262
Function uses <constant> bytes of stack: exceeds /analyze:stacksize<constant>. Consider moving some data to heap
C6263
using _alloca in a loop; this can quickly overflow stack
C6268
Incorrect order of operations: (<TYPE1>)(<TYPE2>)x + y. Possible missing parentheses in (<TYPE1>)((<TYPE2>)x + y)
C6269
possible incorrect order of operations: dereference ignored
C6270
missing float argument to <function>: add a float argument corresponding to conversion specifier <number>
C6271
extra argument passed to <function>: parameter <number> is not used by the format string
C6272
non-float passed as argument <number> when float is required in call to <function>
C6273
warning 6273 - non-integer passed as parameter <number> when integer is required in call to <function>: if a pointer value is being passed, %p should be used
C6274
non-character passed as parameter <number> when character is required in call to <function>
C6276
Cast between semantically different string types: char* to wchar_t*. Use of invalid string can lead to undefined behavior
C6277
NULL application name with an unquoted path in call to <function>: results in a security vulnerability if the path contains spaces
C6278
<variable> is allocated with array new [], but deleted with scalar delete. Destructors will not be called
C6279
<variable> is allocated with scalar new, deleted with array delete []
C6280
<variable> is allocated with <function>, but deleted with <function>
C6281
warning 6281 - incorrect order of operations: relational operators have higher precedence than bitwise operators
C6282
Incorrect operator: assignment of constant in Boolean context. Consider using '==' instead
C6283
<variable> is allocated with array new [], but deleted with scalar delete
C6284
object passed as parameter '%d' when string is required in call to <function>.
C6285
(<non-zero constant> || <non-zero constant>) is always a non-zero constant. Did you intend to use the bitwise-and operator?
C6286
(<non-zero constant> || <expression>) is always a non-zero constant. <expression> is never evaluated and may have side effects
C6287
redundant code: the left and right sub-expressions are identical
C6288
Incorrect operator: mutual inclusion over && is always zero. Did you intent to use || instead?
C6289
Incorrect operator: mutual exclusion over || is always a non-zero constant. Did you intend to use && instead?
C6290
Bitwise operation on logical result: ! has higher precedence than &. Use && or (!(x & y)) instead
C6291
Bitwise operation on logical result: ! has higher precedence than |. Use || or (!(x | y)) instead
C6292
ill-defined for-loop: counts up from maximum
C6293
Ill-defined for-loop: counts down from minimum
C6294
Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed
C6295
Ill-defined for-loop: <variable> values are of the range "min" to "max". Loop executed indefinitely
C6296
Ill-defined for-loop: Loop body only executed once
C6297
Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value. Result may not be an expected value
C6298
using a read-only string <pointer> as a writable string argument: this will attempt to write into static read-only memory and cause random crashes
C6299
explicitly comparing a bit field to a Boolean type will yield unexpected results
C6302
format string mismatch: character string passed as parameter <number> when wide character string is required in call to <function>
C6303
format string mismatch: wide character string passed as parameter <number> when character string is required in call to <function>
C6305
potential mismatch between sizeof and countof quantities
C6306
incorrect call to <function>: consider using <function> which accepts a va_list as an argument
C6308
'realloc' may return null pointer: assigning a null pointer to <variable>, which is passed as an argument to 'realloc', will cause the original memory block to be leaked
C6309
argument <number> is null: it does not adhere to function specification of <function>
C6310
illegal constant in exception filter can cause unexpected behavior
C6312
Possible infinite loop: use of the constant EXCEPTION_CONTINUE_EXECUTION in the exception-filter expression of a try-except
C6313
Incorrect operator: Zero-valued flag cannot be tested with bitwise-and. Use an equality test to look for zero-valued flags
C6314
Incorrect order of operations: bitwise-or has higher precedence than the conditional-expression operator. Add parentheses to clarify intent
C6315
Incorrect order of operations: bitwise-and has higher precedence than bitwise-or. Add parentheses to clarify intent
C6316
Incorrect operator: tested expression is constant and non-zero. Use bitwise-and to determine whether bits are set
C6317
incorrect operator: logical-not (!) is not interchangeable with ones-complement (~)
C6318
Ill-defined __try/__except: use of the constant EXCEPTION_CONTINUE_SEARCH or another constant that evaluates to zero in the exception-filter expression. The code in the exception handler block is not executed
C6319
use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects
C6320
exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This may mask exceptions that were not intended to be handled
C6322
empty _except block
C6323
warning 6323 - use of arithmetic operator on Boolean type(s)
C6324
potential incorrect use of <function1>: Did you intend to use <function2>?
C6326
potential comparison of a constant with another constant
C6327
Potential buffer overrun: SysAllocStringLen copies <number> characters from the string <variable> without validating the number of characters to copy. The code may crash
C6328
warning C6328:<type> passed as parameter <number> when <type> is required in call to <function>
C6331
Invalid parameter: passing MEM_RELEASE and MEM_DECOMMIT in conjunction to <function> is not allowed. This results in the failure of this call
C6332
Invalid parameter: passing zero as the dwFreeType parameter to <function> is not allowed. This results in the failure of this call
C6333
Invalid parameter: passing MEM_RELEASE and a non-zero dwSize parameter to <function> is not allowed. This results in the failure of this call
C6334
sizeof operator applied to an expression with an operator may yield unexpected results
C6335
leaking process information handle <handlename>
C6336
arithmetic operator has precedence over question operator, use parentheses to clarify intent
C6381
Shutdown API <function> requires a valid dwReason or lpMessage
C6383
buffer overrun due to conversion of an element count into a byte count: an element count is expected for parameter <number> in call to <function>
C6384
dividing sizeof a pointer by another value
C6385
invalid data: accessing <buffer name>, the readable size is <size1> bytes, but <size2> bytes may be read: Lines: x, y
C6386
buffer overrun: accessing <buffer name>, the writable size is <size1> bytes, but <size2> bytes may be written: Lines: x, y
C6387
<argument> may be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y
C6388
<argument> may not be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y
C6400
Using <function name> to perform a case-insensitive compare to constant string <string name>. Yields unexpected results in non-English locales
C6401
Using <function name> in a default locale to perform a case-insensitive compare to constant string < string name>. Yields unexpected results in non-English locales
C6500
invalid annotation: value for <name> property is invalid
C6501
annotation conflict: <name> property conflicts with previously specified property
C6503
annotation conflict: references may not be marked Null=Yes or Null=Maybe
C6504
invalid annotation: property may only be used on values of pointer, pointer-to-member, or array type
C6505
invalid annotation: MustCheck property may not be used on values of void type
C6506
invalid annotation: <name> property may only be used on values of pointer or array types
C6507
annotation conflict: Null property at Deref=0 on a post condition must be a subset of the Null property on the precondition
C6508
invalid annotation: write access is not allowed on const values
C6509
invalid annotation: 'return' cannot be referenced from a precondition
C6510
invalid annotation: NullTerminated property may only be used on values of pointer or array type
C6511
invalid annotation: MustCheck property must be Yes or No
C6512
invalid annotation: Null property must be Maybe if the Valid property is No
C6513
invalid annotation: ElementSizeConst requires additional size properties
C6514
invalid annotation: value of the <name> property exceeds the size of the array
C6515
warning C6515 - invalid annotation: <name> property may only be used on values of pointer type
C6516
invalid annotation: no properties specified for <name> attribute
C6517
annotation conflict: ValidElementsConst and ValidBytesConst may not be specified on the buffers that are not readable
C6518
annotation conflict: WriteableElementsConst and WriteableBytesConst may not be specified on buffers that are not writable
C6521
invalid size specification: * operator can only be applied to pointer types
C6522
invalid size specification: expression must be of integral type
C6523
invalid size specification: parameter <name> not found
C6525
invalid size specification: property value may not be valid
C6526
warning C6526 - invalid size specification: expression must be of array or pointer type
C6530
warning 6530: unrecognized format string style <name>
C6535
buffer cannot be of size <n>, bigger than max(size_t)