具有ConcurrentDictionary的Apache Ignite中的InvalidCastException

时间:2019-02-27 20:26:38

标签: asp.net-core ignite

我有一个具有ConcurrentDictionary字段的对象。 访问Ignite共享内存中的数据时,出现以下错误。

System.InvalidCastException: [A]System.Collections.Concurrent.ConcurrentDictionary'2[System.String,CampaignEngine.Model.LookupItem] cannot be cast to [B]System.Collections.Concurrent.ConcurrentDictionary'2[System.String,CampaignEngine.Model.LookupItem]. Type A originates from 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.2\System.Private.CoreLib.dll'. Type B originates from 'System.Collections.Concurrent, Version=4.0.14.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.2\System.Collections.Concurrent.dll
at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.ReadBinary[T](BinaryReader reader, IBinaryTypeDescriptor desc, Int32 pos, Type typeOverride)
 at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadFullObject[T](Int32 pos, Type typeOverride)
 at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res, Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T](Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadObject[T](String fieldName)
at lambda_method(Closure , Object , IBinaryReader )
at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.ReadBinary[T](BinaryReader reader, IBinaryTypeDescriptor desc, Int32 pos, Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadFullObject[T](Int32 pos, Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res, Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T](Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadBinaryObject[T](Boolean doDetach)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res, Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T](Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.Marshaller.Unmarshal[T](IBinaryStream stream, Boolean keepBinary)
at Apache.Ignite.Core.Impl.PlatformJniTarget.InStreamOutLong[TR](Int32 type, Action'1 outAction, Func'3 inAction, Func'2 readErrorAction)
at Apache.Ignite.Core.Impl.Cache.CacheImpl'2.Get(TK key)
at Apache.Ignite.Core.Impl.Cache.CacheImpl'2.get_Item(TK key)

为什么不能点燃反序列化ConcurrentDictionary?

谢谢...

1 个答案:

答案 0 :(得分:0)

好像您在代码中的某个位置导入了问题,可能是由于Why is Visual Studio telling me I need to reference System.Private.CoreLib?

检查您的任何源文件以引用System.Private.CoreLib,并将其替换为System.Collections.Concurrent