[英]“key was not present in the dictionary” when using generic orleans grains
Just upgraded to 1.3.0 and am having issue with generic grains. 刚刚升级到1.3.0,我遇到了仿制药问题。
An example interface and class that's showing this issue: 显示此问题的示例界面和类:
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);
}
}
then using it like: 然后使用它像:
var grain = await GrainFactory.GetGrain<IGenericTest<int>>(0); // Runs without error.
await grain.Print(1);
Getting the grain seems to be fine, but when I call the method on the grain I get: 获得谷物似乎很好,但当我在谷物上调用方法时,我得到:
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()
Is there something I'm missing? 有什么我想念的吗? Maybe some new configuration?
也许一些新的配置? This worked fine with the previous version I was using.
这与我之前使用的旧版本一起工作正常。
EDIT: 编辑:
Seems like it's an issue with the invoke interceptor: 似乎这是invoke拦截器的一个问题:
providerRuntime.SetInvokeInterceptor((method, request, grain, invoker) => { return invoker.Invoke(grain, request); }); providerRuntime.SetInvokeInterceptor((method,request,grain,invoker)=> {return invoker.Invoke(grain,request);});
When that's removed everything works. 什么时候删除它一切正常。
问题在这里得到解答: https : //github.com/dotnet/orleans/issues/2358这是一个错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.