To reproduce:
var code =
"""
using Rocks;
#nullable enable
public class Tracer
{
public virtual void TraceEvent(string? eventCache, string source,
string eventType, int id,
string? format, params object?[]? args)
{ }
}
public class SubTracer
: Tracer
{
public override void TraceEvent(string eventCache, string source,
string eventType, int id,
string format, params object[] args)
{ }
}
public static class Test
{
public static void Go() => Rock.Create<SubTracer>();
}
""";
The issue is that Rocks thinks there are two TraceEvent() methods that can be overridden, but C# considers those to be "duplicates" and will create a CS0111 error.
Arguably, SubTracer shouldn't be changing the nullability of the parameter types (see CS8765 and CS8610 for details), but Rocks needs to handle this scenario. I'm guessing that when I look for duplicate methods (which would include indexers (maybe?)) that I do not look at the nullability decorations on the type.
Side note: when I did this in SharpLab, the overriding member is the one for the subclass, so I should do that as well in Rocks. I think I already do this, but just need to make sure this is correct.
This was found in Topshelf.Logging.TopshelfConsoleTraceListener, version 4.3.0.
To reproduce:
The issue is that Rocks thinks there are two
TraceEvent()methods that can be overridden, but C# considers those to be "duplicates" and will create aCS0111error.Arguably,
SubTracershouldn't be changing the nullability of the parameter types (seeCS8765andCS8610for details), but Rocks needs to handle this scenario. I'm guessing that when I look for duplicate methods (which would include indexers (maybe?)) that I do not look at the nullability decorations on the type.Side note: when I did this in SharpLab, the overriding member is the one for the subclass, so I should do that as well in Rocks. I think I already do this, but just need to make sure this is correct.
This was found in
Topshelf.Logging.TopshelfConsoleTraceListener, version 4.3.0.