Issues with deserializing MessagePack objects #2228
Replies: 3 comments 2 replies
-
|
I've tried different MessagePack library, which does return proper data for indices 1 and 5: |
Beta Was this translation helpful? Give feedback.
-
This suggests the msgpack you're trying to deserialize is using a map. But your Try removing the Key attributes, and change |
Beta Was this translation helpful? Give feedback.
-
|
The I get a resolver error. The decoded messagepack actually looks similar to this (just a few fields, for the general idea). That's why I used the Key("0") etc. { |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm new to MessagePack and I have a few issues at hand. I'm receiving data but when I'm trying to Deserialize the data to a [MessagePack] object, I get the "MessagePackSerializationException: Unexpected msgpack code 138 (fixmap) encountered.". Even with the simplest of classes I cannot get this to work.
I cannot control what is being sent, as this is done by another party, and I cannot really find any help on how to properly configure it on my end. I'm using .NET 8.0 as it's going to run on a Linux server.
My testclass:
[MessagePackObject] public class MyClass { [Key(1)] public Int64 DeviceId { get; set; } }Deserializing it to a dynamic or an object does work, however the values I get often contain replacement characters. There is a field which contain bytearrays of data, but converting it to a dynamic or object, results in this field being deserialized as an array of object, causing data loss.
Calling the deserialization as dynamic:
var obj = MessagePackSerializer.Deserialize<dynamic>(bytes);and the resulting Key 34 which is parsed as an object array causing dataloss.

I'm not sure the data loss is even related to MessagePack, but any help would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions