APICompat misses a breaking change where an interface removes a method that was present on a base interface #36502
Open
Description
Describe the bug
Consider the following:
public interface IBase
{
void M1();
void M2();
}
public interface IDerived : IBase
{
new void M2();
}
It is not compatible to remove IDerived.M2() because the runtime will fail to load a type if it claims to implement an interface member on the derived interface.
To Reproduce
See apiCompatInterface.zip for a repro.
Install apicompat tool and run the repro script.
You can run the application to demonstrate the binary breaking change:
Unhandled exception. System.MissingMethodException: Method not found: 'Void lib.IDerived.M2()'.
at Program.<Main>$(String[] args)
Expect: Compat error for removing the method.
Actual: No error
This is likely because for classes it's compatible to remove a method if that method was hiding a method on the base. That's not the case for interfaces.