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()
{
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for