sexy-proxy icon indicating copy to clipboard operation
sexy-proxy copied to clipboard

Unable to proxy interface with generics

Open nullpainter opened this issue 4 years ago • 0 comments

I may be missing something, but the following class can't be used to create a non-Fody proxy:

public interface IPoison
{
    void Foo<T>();
}

When trying to create a proxy using:

Proxy.CreateProxy<IPoison>(async invocation =>
{
    await invocation.Proceed();
    return null;
});

I receive:

System.TypeInitializationException : The type initializer for 'SexyProxy.Proxy`1' threw an exception.
  ----> System.TypeLoadException : Method 'Foo' in type 'Test.IPoison$Proxy' from assembly 'Test.IPoison$Proxy, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
   at SexyProxy.Proxy`1.CreateProxy(T target, Func`2 invocationHandler, ProxyPredicate`1 predicate, AsyncInvocationMode asyncMode)

nullpainter avatar Feb 27 '20 07:02 nullpainter