繁体   English   中英

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

[英]“key was not present in the dictionary” when using generic orleans grains

刚刚升级到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()

有什么我想念的吗? 也许一些新的配置? 这与我之前使用的旧版本一起工作正常。

编辑:

似乎这是invoke拦截器的一个问题:

providerRuntime.SetInvokeInterceptor((method,request,grain,invoker)=> {return invoker.Invoke(grain,request);});

什么时候删除它一切正常。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM