C# Error CS1900 – Warning level must be zero or greater

C# Error

CS1900 – Warning level must be zero or greater

Reason for the Error & Solution

Warning level must be in the range 0-4

The compiler option can only take one of five possible values (0, 1, 2, 3, or 4). Any other value passed to /warn will result in CS1900.

The following sample generates CS1900:

// CS1900.cs  
// compile with: /W:5  
// CS1900 expected  
class x  
{  
   public static void Main()  
   {  
   }  
}  

Note

The compiler no longer generates this error. Starting with C# 9, values greater than 4 represent "warning waves" and are valid, even if no warnings are defined for that wave yet.

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...