首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当使用普通的orleans谷物时,"key in not present in the dictionary“

当使用普通的orleans谷物时,"key in not present in the dictionary“
EN

Stack Overflow用户
提问于 2016-10-28 05:52:11
回答 1查看 350关注 0票数 1

刚刚升级到1.3.0,我遇到了通用谷物的问题。

显示此问题的示例接口和类:

代码语言:javascript
复制
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);
    }
}

然后像这样使用它:

代码语言:javascript
复制
var grain = await GrainFactory.GetGrain<IGenericTest<int>>(0); // Runs without error.
await grain.Print(1);

获取颗粒看起来很好,但是当我对得到的颗粒调用方法时:

代码语言:javascript
复制
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(粒度,请求);});

删除后,一切都会正常工作。

EN

回答 1

Stack Overflow用户

发布于 2016-10-29 06:14:55

问题在这里得到了回答:https://github.com/dotnet/orleans/issues/2358,这是一个错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40294771

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档