刚刚升级到1.3.0,我遇到了通用谷物的问题。
显示此问题的示例接口和类:
public interface IGenericTest<T> : IGrainWithIntegerKey
{
Task<T> PrintType(T obj);
}
public class GenericTestGrain<T> : Grain, IGenericTest<T>
{
public Task<T> Print(T obj)
{
Debug.WriteLine("TEST");
return Task.FromResult(obj);
}
}然后像这样使用它:
var grain = await GrainFactory.GetGrain<IGenericTest<int>>(0); // Runs without error.
await grain.Print(1);获取颗粒看起来很好,但是当我对得到的颗粒调用方法时:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Orleans.InterceptedMethodInvokerCache.GetInterfaceToImplementationMap(Int32 interfaceId, Type implementationType)
at Orleans.InterceptedMethodInvokerCache.CreateInterceptedMethodInvoker(Type implementationType, Int32 interfaceId, IGrainMethodInvoker invoker)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Orleans.InterceptedMethodInvokerCache.GetOrCreate(Type implementationType, Int32 interfaceId, IGrainMethodInvoker invoker)
at Orleans.Runtime.InsideRuntimeClient.InvokeWithInterceptors(IAddressable target, InvokeMethodRequest request, IGrainMethodInvoker invoker)
at Orleans.Runtime.InsideRuntimeClient.<Invoke>d__57.MoveNext()我是不是漏掉了什么?也许是一些新的配置?这在我使用的前一个版本中工作得很好。
编辑:
看起来这是调用拦截器的问题:
ProviderRuntime.SetInvokeInterceptor((方法,请求,粒度,调用器) => { return invoker.Invoke(粒度,请求);});
删除后,一切都会正常工作。
发布于 2016-10-29 06:14:55
问题在这里得到了回答:https://github.com/dotnet/orleans/issues/2358,这是一个错误。
https://stackoverflow.com/questions/40294771
复制相似问题