InvalidCastException in Apache Ignite with ConcurrentDictionary - asp.net-core

I have an object which has ConcurrentDictionary field.
I am getting the error below, when accessing data in Ignite Shared memory.
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)
Why can't Ignite deserialize ConcurrentDictionary?
Thanks...

Looks like you have importing issue somewhere in your code, maybe due to Why is Visual Studio telling me I need to reference System.Private.CoreLib?
Check any of your source files for reference to System.Private.CoreLib and replace it to System.Collections.Concurrent.

Related

Ignite.Net 2.12.0 fails on startup

Since upgrading to Apache.Ignite 2.12.0, Ignite fails to start up with the following error:
Unhandled exception. Apache.Ignite.Core.Common.IgniteException: Failed to start Ignite.NET, check inner exception for details
System.ArgumentException: Seek before origin: -1953261975
at Apache.Ignite.Core.Impl.Memory.PlatformMemoryStream.Seek(Int32 offset, SeekOrigin origin)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadHandleObject[T](Int32 pos, Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.Read[T](Func`1 readFunc, Byte expHdr)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.Read[T](Func`2 readFunc, Byte expHdr)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadString()
at Apache.Ignite.Core.Configuration.DataRegionConfiguration..ctor(IBinaryRawReader reader)
at Apache.Ignite.Core.Configuration.DataStorageConfiguration.<>c__DisplayClass27_0.<.ctor>b__0(Int32 x)
at System.Linq.Enumerable.SelectRangeIterator`1.ToArray()
at Apache.Ignite.Core.Configuration.DataStorageConfiguration..ctor(IBinaryRawReader reader)
at Apache.Ignite.Core.IgniteConfiguration.ReadCore(BinaryReader r)
at Apache.Ignite.Core.IgniteConfiguration.Read(BinaryReader binaryReader)
at Apache.Ignite.Core.IgniteConfiguration..ctor(BinaryReader binaryReader, IgniteConfiguration baseConfig)
at Apache.Ignite.Core.Impl.Ignite.<GetConfiguration>b__87_0(IBinaryStream s)
at Apache.Ignite.Core.Impl.PlatformJniTarget.OutStream[T](Int32 type, Func`2 readAction)
at Apache.Ignite.Core.Impl.PlatformTargetAdapter.DoInOp[T](Int32 type, Func`2 action)
at Apache.Ignite.Core.Impl.Ignite.GetConfiguration()
at Apache.Ignite.Core.Impl.Ignite.SetCompactFooter()
at Apache.Ignite.Core.Impl.Ignite..ctor(IgniteConfiguration cfg, String name, IPlatformTargetInternal proc, Marshaller marsh, IList`1 lifecycleHandlers, UnmanagedCallbacks cbs)
at Apache.Ignite.Core.Ignition.OnStart(GlobalRef interopProc, IBinaryStream stream)
at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.OnStart(Int64 memPtr, Int64 unused, Int64 unused1, Void* proc)
at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.InLongLongLongObjectOutLong(Int32 type, Int64 val1, Int64 val2, Int64 val3, IntPtr arg)
at Apache.Ignite.Core.Impl.Unmanaged.Jni.Callbacks.InLongLongLongObjectOutLong(IntPtr env, IntPtr clazz, Int64 igniteId, Int32 op, Int64 arg1, Int64 arg2, Int64 arg3, IntPtr arg)
Any assistance would be appreciated

Need help defining a machine integer

I'm using the mach.int library in a specification (see also this question), and I'm trying to define a constant that is of type int32:
let constant_out1: int32 = 1 in
…
However, when analyzing this, why3 returns the message:
This term has type int, but is expected to have type int32
I noticed that Bounded_int (which Int32 instantiates with type int32) has the following in it:
val of_int (n:int) : t
requires { "expl:integer overflow" in_bounds n }
ensures { to_int result = n }
However, I do not seem to be able to use this to cast 1 to int32. For example, if I use:
let constant_out1: int32 = Int32.of_int(1) in
…
I get the message unbound symbol 'Int32.of_int'. I've tried many permutations of this, all without any success. Can anyone provided guidance for how to tell why3 that I want 1 to be of type int32?

Sitecore Crawler : AddRecursive DoItemAdd failed

Our crawler log is filled with the following Index Out of Bounds Exception. Has anyone seen this error? Or have any ideas on how to resolve?
4548 00:37:31 WARN Crawler : AddRecursive DoItemAdd failed - {DDAFF741-80D0-4650-8E73-02A88EB2C8DC}
Exception: System.IndexOutOfRangeException
Message: Index was outside the bounds of the array.
Source: Sitecore.Kernel
at Sitecore.Caching.ItemPathsCache.UpdateKeyIndex(List`1 list, String value)
at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, TValue addValue, Func`3 updateValueFactory)
at Sitecore.Caching.ItemPathsCache.AddMapping(Item item, ItemPathType itemPathType, String path)
at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String separator, ItemPathType type, Item root, Int32 level)
at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String separator, ItemPathType type, Item root, Int32 level)
at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String separator, ItemPathType type, Item root, Int32 level)
at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String separator, ItemPathType type, Item root, Int32 level)
at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String separator, ItemPathType type)
at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String from, String separator, ItemPathType type)
at Sitecore.Data.ItemPath.GetPath(Item currentItem, String from, String separator, ItemPathType type)
at Sitecore.Data.ItemPath.get_ContentPath()
at Sitecore.ContentSearch.SitecoreItemCrawler.DoAdd(IProviderUpdateContext context, SitecoreIndexableItem indexable)
at Sitecore.ContentSearch.HierarchicalDataCrawler`1.CrawlItem(T indexable, IProviderUpdateContext context, CrawlState`1 state)

IOMutable vs MutableIO File

I am trying to load a file.
I have:
wf :: STMutable a File
wf = File.new "worlds/seed_77.world"
data PickleSerialization = pure native com.github.lands.PickleSerialization where
native loadWorld com.github.lands.PickleSerialization.loadWorld :: MutableIO File -> IO World throws IOException, IncorrectFileException
If I try to do:
PickleSerialization.loadWorld wf
I get this error, which seems very confusing to me:
[ERROR: 4]: type error in expression wf
type is IOMutable File
used as MutableIO File
wf returns an action that produces a file. loadWorld takes a file, not an action. I think this should work: wf >>= loadWorld.
MutableIO File represents a mutable file whereas IOMutable is an action that returns a mutable file. IOMutable is defined as (taken from the source):
--- This is an abbreviation for #ST RealWorld (Mutable RealWorld d)#
type IOMutable d = IO (MutableIO d)
Similarly STMutable is defined as,
--- The type of 'ST' actions that return a mutable value of type _d_
--- This is an abbreviation for #ST s (Mutable s d)#
type STMutable s d = ST s (Mutable s d)

...array<Object^>^ args

I'm reading C++/CLI. I see this stuff:
Object^ CreateInstanceFromTypename(String^ type, ...array<Object^>^ args)
{
if (!type)
throw gcnew ArgumentNullException("type");
Type^ t = Type::GetType(type);
if (!t)
throw gcnew ArgumentException("Invalid type name");
Object^ obj = Activator::CreateInstance(t, args);
return obj;
}
When calling it:
Object^ o = CreateInstanceFromTypename(
"System.Uri, System, Version=2.0.0.0, "
"Culture=neutral, PublicKeyToken=b77a5c561934e089",
"http://www.heege.net"
);
What is ...array^ args? If I remove ... ,there's a complied-error:
error C2665: 'CreateInstanceFromTypeName' : none of the 2 overloads could convert all the argument types
1> .\myFourthCPlus.cpp(12): could be 'System::Object ^CreateInstanceFromTypeName(System::String ^,cli::array<Type> ^)'
1> with
1> [
1> Type=System::Object ^
1> ]
1> while trying to match the argument list '(const char [86], const char [21])'
Like C++, C++/CLI has a mechanism for a variable amount of arguments. That is what the ... in front of the ...array<Object^>^ parameter means.
For type safety the C++/CLI designers added managed syntax to declare the type of the variable array.
Since it's just passing that parameter to the Activator::CreateInstance() function, I would look at what variable parameters the Activator function is looking for.