All inherited interface members should be implemented on an interface marked with DynamicInterfaceCastableImplementationAttribute (original) (raw)

An interface marked with a System.Runtime.InteropServices.DynamicInterfaceCastableImplementationAttribute attribute should provide a default interface implementation of all inherited interface methods and should not provide any new non-private interface methods without a default implementation.

interface Foo { void Frob(); }

[DynamicInterfaceCastableImplementation] interface Bar : Foo { void Baz(); }

Category: Usage
Default: Enabled
Severity: Warning

When a method is not implemented, a warning will be emitted on the attributed interface name. A code fix will be offered to implement the method with a default implementation that throws a NotImplementedException.

When a method is defined on the implementation interface, a warning will be emitted on the method name. If the method has a body, a code fix will be offered to make the method public sealed. Otherwise, a code fix will be offered to make the method sealed and add a body that throws a NotImplementedException.

cc @terrajobst @stephentoub @AaronRobinsonMSFT @elinor-fung