netserializer icon indicating copy to clipboard operation
netserializer copied to clipboard

Error while serializing dictionary

Open MisterSokol opened this issue 9 months ago • 0 comments

Hi,

There is a problem with serialization and deserialization of dictionaries.

I want to serialize with the Serializer created like this

new NetSerializer.Serializer(new [] { typeof(Dictionary<string, object>) });

but I'm getting an error System.Collections.Generic.KeyNotFoundException: 'Type not found System.Double'

When I add to the serialized types typeof(double) it works for now but then fails on deserialization.

Deserialization with only typeof(Dictionary<string, object>) gives error: System.NullReferenceException in NetSerializer.Serializer.GetDeserializeTrampolineFromId method And deserializing with typeof(Dictionary<string, object>) and typeof(double) finishes without error but... The deserialized data is trash. Just a single double number instead of dictionary. And the stream position is 4 (didn't went to the end)

MisterSokol avatar May 15 '24 08:05 MisterSokol