C#

C#

Made by DeepSource

Missing implementation of members wrapped in an interface attributed with DynamicInterfaceCastableImplementation CS-W1066

Bug risk
Critical

Interfaces attributed with the DynamicInterfaceCastableImplementation attribute must contain methods that are marked static and have an implementation. Failing to do so violates the DynamicInterfaceCastableImplementation contract and may lead to runtime exceptions.

Bad Practice

[DynamicInterfaceCastableImplementation]
interface IFoo
{
    public void Bar()
    {
        // ...
    }
}

Recommended

[DynamicInterfaceCastableImplementation]
interface IFoo
{
    public static void Bar()
    {
        // ...
    }
}

Reference