Friday, December 04, 2015

List of C# Compiler Warnings

Generally, you want to fix compiler warnings as they come up, but you may need to suppress some of them for legitimate reasons. A list of warnings and errors can be found here, but there’s no high-level list.
Here is a summarized list of warnings.


Warning Description More Info

Level 1 Warnings (Severe)

CS0420 ‘identifier’: a reference to a volatile field will not be treated as volatile
CS0465 Introducing a ‘Finalize’ method can interfere with destructor invocation.
CS1058 A previous catch clause already catches all exceptions
CS1060 Use of possibly unassigned field 'name'. Struct instance variables are initially unassigned if struct is unassigned.
CS1598 XML parser could not be loaded for the following reason: 'reason'. The XML documentation file 'file' will not be generated.
CS1607 A warning was generated from the assembly-creation phase of the compilation.
CS1616 Option 'option' overrides attribute 'attribute' given in a source file or added module
CS1658 'warning text'. See also error 'error code'
The compiler emits this warning when it overrides an error with a warning.
CS1683 Reference to type 'Type Name' claims it is defined in this assembly, but it is not defined in source or any added modules
CS1685 The predefined type 'System.type name' is defined in multiple assemblies in the global alias; using definition from 'File Name'
CS1690 Accessing a member on 'member' may cause a runtime exception because it is a field of a marshal-by-reference class
CS1691 'number' is not a valid warning number
CS1699 Use command line option "compiler_option" or appropriate project settings instead of "attribute_name"
CS1762 A reference was created to embedded interop assembly '<assembly1>' because of an indirect reference to that assembly from assembly '<assembly2>'. Consider changing the 'Embed Interop Types' property on either assembly.
CS1956 Member 'name' implements interface member 'name' in type 'type'. There are multiple matches for the interface member at run-time. It is implementation dependent which method will be called.
CS3003 Type of 'variable' is not CLS-compliant
CS3007 Overloaded method 'method' differing only by unnamed array types is not CLS-compliant
CS3009 'type': base type 'type' is not CLS-compliant
CS4014 Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Level 2 Warnings

CS0108 'member1' hides inherited member 'member2'. Use the new keyword if hiding was intended.
CS0467 Inherited members from different interfaces that have the same signature cause an ambiguity error.
CS0618 'member' is obsolete: 'text'
CS1701 Assuming assembly reference "Assembly Name #1" matches "Assembly Name #2", you may need to supply runtime policy

Level 3 Warnings (Less Severe)

CS0675 Bitwise-or operator used on a sign-extended operand; consider casting to a smaller unsigned type first
CS1700 Assembly reference Assembly Name is invalid and cannot be resolved

Level 4 Warnings (Informational)

CS0429 Unreachable expression code detected
CS1591 Missing XML comment for publicly visible type or member 'Type_or_Member'
CS1610 Unable to delete temporary file 'file' used for default Win32 resource -- resource

submit to reddit