To reproduce:
using Rocks;
#nullable enable
public abstract class ValueComparer
{
public abstract object? Snapshot(object? instance);
}
public class ValueComparer<T>
: ValueComparer
{
public override object? Snapshot(object? instance) => null;
public virtual T Snapshot(T instance) => default;
}
public class GeometryValueComparer<TGeometry>
: ValueComparer<TGeometry> { }
public static class Test
{
public static void Generate()
{
var rock = Rock.Create<GeometryValueComparer<object>>();
}
}
This will create multiple diagnostics:
error CS8603: Possible null reference return.
error CS0462: The inherited members 'ValueComparer<T>.Snapshot(object?)' and 'ValueComparer<T>.Snapshot(T)' have the same signature in type 'CreateExpectationsOfGeometryValueComparerOfobjectExtensions.RockGeometryValueComparerOfobject', so they cannot be overridden
error CS8604: Possible null reference argument for parameter 'instance' in 'object ValueComparer<object>.Snapshot(object instance)'.
error CS0111: Type 'CreateExpectationsOfGeometryValueComparerOfobjectExtensions.RockGeometryValueComparerOfobject' already defines a member called 'Snapshot' with the same parameter types
error CS0462: The inherited members 'ValueComparer<T>.Snapshot(object?)' and 'ValueComparer<T>.Snapshot(T)' have the same signature in type 'CreateExpectationsOfGeometryValueComparerOfobjectExtensions.RockGeometryValueComparerOfobject', so they cannot be overridden
error CS0111: Type 'MethodExpectationsOfGeometryValueComparerOfobjectExtensions' already defines a member called 'Snapshot' with the same parameter types
The main ones are CS0462 and CS0111, though CS8604 should be addressed as well.
This was discovered on Microsoft.EntityFrameworkCore.ChangeTracking.GeometryValueComparer<>.
To reproduce:
This will create multiple diagnostics:
The main ones are
CS0462andCS0111, thoughCS8604should be addressed as well.This was discovered on
Microsoft.EntityFrameworkCore.ChangeTracking.GeometryValueComparer<>.