Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) CS1635

Cannot restore warning 'warning code' because it was disabled globally

This warning occurs if you use the /nowarn command line option or project setting to disable a warning for the entire compilation unit, but you use #pragma warning restore to attempt to restore that warning. To resolve this error, remove the /nowarn command line option or project setting, or remove the #pragma warning restore for any warnings you are disabling via the command line or project settings. For more information, see the #pragma warning topic.

The following sample generates CS1635:

// CS1635.cs
// compile with: /w:1 /nowarn:162

enum MyEnum {one=1,two=2,three=3};

class MyClass
    public static void Main()
#pragma warning disable 162

    if (MyEnum.three == MyEnum.two)

#pragma warning restore 162

Community Additions

© 2015 Microsoft