protobuf-net : Getting exception while creating client for Service which has Generic methods

428 Views Asked by At

I am working with protobuf-net v3.0.101 and getting one exception while creating client for a Service which has generic methods. Let say the service is like this :

[ServiceContract(Name = "UnitTests.Rpc.Calculator")]
public interface ICalculator
{
    CalculationResult<T> Square<T>(OneVar<T> oneVar);
}

While client creation I am getting below error :

* FAIL: Error: Unhandled exception in required test method. The type initializer for 'DefaultProxyCache`1' threw an exception. (System.TypeInitializationException: The type initializer for 'DefaultProxyCache`1' threw an exception. ---> System.TypeLoadException: Signature of the body and declaration in a method implementation do not match.  Type: 'ProtoBuf.Grpc.Internal.Proxies.ClientBase.ICalculator_Proxy_0'.  Assembly: 'ProtoBuf.Grpc.Internal.Proxies, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type)
   at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.TypeBuilder.CreateType()
   at ProtoBuf.Grpc.Internal.ProxyEmitter.EmitFactory[TService](BinderConfiguration binderConfig)
   at ProtoBuf.Grpc.Configuration.ClientFactory.DefaultProxyCache`1..cctor()
   --- End of inner exception stack trace ---
   at ProtoBuf.Grpc.Configuration.ClientFactory.DefaultClientFactory.CreateClient[TService](CallInvoker channel)

Is there a way, I can fix this issue ? Any update ?

0

There are 0 best solutions below