-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Milestone
Description
This code:
public interface ISample
{
void Foo(in int bar);
}
public class SampleProxy : DispatchProxy
{
public static ISample CreateProxy()
{
return DispatchProxy.Create<ISample, SampleProxy>();
}
protected override object Invoke(MethodInfo targetMethod, object[] args)
{
return null;
}
}
[Test]
public void CreateProxyTest()
{
var proxy = SampleProxy.CreateProxy();
}throws the exception
System.TypeLoadException : Signature of the body and declaration in a method implementation do not match. Type: 'generatedProxy_1'. Assembly: 'ProxyBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
at System.Reflection.Emit.TypeBuilder.CreateTypeInfo()
at System.Reflection.DispatchProxyGenerator.ProxyBuilder.CreateType()
at System.Reflection.DispatchProxyGenerator.GenerateProxyType(Type baseType, Type interfaceType)
at System.Reflection.DispatchProxyGenerator.GetProxyType(Type baseType, Type interfaceType)
at System.Reflection.DispatchProxyGenerator.CreateProxyInstance(Type baseType, Type interfaceType)
at System.Reflection.DispatchProxy.Create[T,TProxy]()