Compiler Warning (level 1) CS0672
TOC
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

Compiler Warning (level 1) CS0672

Member 'member1' overrides obsolete member 'member2. Add the Obsolete attribute to 'member1'

The compiler found an override to a method marked as obsolete. However, the overriding method was not itself marked as obsolete. The overriding method will still generate CS0612, if called.

Review your method declarations and explicitly indicate whether a method (and all of its overrides) should be marked obsolete.

The following sample generates CS0672:

// CS0672.cs
// compile with: /W:1
class MyClass
{
   [System.Obsolete]
   public virtual void ObsoleteMethod()
   {
   }
}

class MyClass2 : MyClass
{
   public override void ObsoleteMethod()   // CS0672
   {
   }
}

class MainClass
{
   static public void Main()
   {
   }
}
Show:
© 2016 Microsoft