There is no compile-time error if a type only partially implements an interface with static abstract members (IWSAM). If you try to use the partial implementation, a System.TypeLoadException is raised at runtime.
Repro steps
#nowarn"3535"typeIFace=static abstractP1 :intstatic abstractP2 :inttypeT=interface IFace withstatic memberP1=1let inlinep1<'T& #IFace>= 'T.P1
p1<T>
Runtime error:
Unhandled exception. System.TypeLoadException: Virtual static method 'get_P2' is not implemented on type 'T' from assembly 'ConsoleApp1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at <StartupCode$ConsoleApp1>.$Program.main@()
Expected behavior
There should be a compile-time error indicating that all abstract methods on the interface must be implemented.
Actual behavior
There is no compile-time error; there is an error at runtime instead.
Known workarounds
N/A
Related information
.NET 8/9 preview.
There is no compile-time error if a type only partially implements an interface with static abstract members (IWSAM). If you try to use the partial implementation, a
System.TypeLoadExceptionis raised at runtime.Repro steps
Runtime error:
Expected behavior
There should be a compile-time error indicating that all abstract methods on the interface must be implemented.
Actual behavior
There is no compile-time error; there is an error at runtime instead.
Known workarounds
N/A
Related information
.NET 8/9 preview.