Skip to content

Hidden Object Methods Cannot Be Overriden #206

@JasonBock

Description

@JasonBock

To reproduce:

public class StaticToString
{
  protected static new string ToString() => "c";   
}

public static class Test
{
  public static void Go() => Rock.Create<StaticToString>();
}

This causes CS0176 and CS0506. Basically, ToString() is new and also static (though if you remove static the same problem happens) so it can't be overridden.

This was found with Microsoft.EntityFrameworkCore.Storage.ValueConversion.TimeSpanToStringConverter.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions