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((メソッド、リクエスト、グレイン、インボーカー) => { インボーカーを返す.Invoke(グレイン、リクエスト); });
それが削除されると、すべてが機能します。