Compiler error CS0243

The Conditional attribute is not valid on 'method' because it is an override method

The ConditionalAttribute attribute is not allowed on a method that is marked with the override keyword. For more information, see Knowing When to Use Override and New Keywords.

The compiler never binds to override methods. It only binds to the base method, and the common language runtime calls the override, as appropriate.

The following code generates CS0243:

// CS0243.cs  
// compile with: /target:library  
public class MyClass  
{  
   public virtual void M() {}  
}  
  
public class MyClass2 : MyClass  
{  
   [System.Diagnostics.ConditionalAttribute("MySymbol")]   // CS0243  
   // remove Conditional attribute or remove override keyword  
   public override void M() {}  
}