简体   繁体   English

当使用通用的奥尔良谷物时,“关键词不在词典中”

[英]“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.

相关问题 Microsoft Orleans 中的限制粒度 - Throttling grains in Microsoft Orleans 奥尔良谷物中的单线程 - Single-Threading in Orleans grains 在启动时从 MySQL 服务器加载到 memory 时过滤掉 Orleans Reminder Grains - Filtering out Orleans Reminder Grains at startup when they load into the memory from MySQL server 我可以将奥尔良用于过程演员/谷物吗? - Can I use Orleans for in process actors / grains? 了解奥尔良谷物的单线程性质 - Understanding single-threaded nature of Orleans grains 为什么在“奥尔良谷物分类收集”项目中不认可奥尔良? - Why is Orleans not recognized in 'Orleans Grains Class Collection' project? System.Collections.Generic.KeyNotFoundException:给定的键不在字典中 - System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary System.Collections.Generic.KeyNotFoundException:字典中不存在给定的键“Item” - System.Collections.Generic.KeyNotFoundException : The given key 'Item' was not present in the dictionary System.Collections.Generic.KeyNotFoundException:字典中不存在给定键“All” - System.Collections.Generic.KeyNotFoundException: The given key 'All' was not present in the dictionary 使用自定义类作为键时,“给定键不存在于字典中”错误 - “the given key was not present in the dictionary” error when using a self-defined class as key
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM