Replies: 1 comment 2 replies
-
|
Thanks for the detailed report. I'm pretty sure it has to do with boxing in .NET. Yes, we could fix it, but that would sacrifice knowing the original runtime type. If you deserialized the original msgpack using a dictionary typed with Maintaining the underlying value type is important because we have .NET programs that have |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I noticed that if I deserialize the example shown in the "Try!" functionality on https://msgpack.org (
{"compact":true,"schema":0}) usingMessagePackSerializer.Deserialize<Dictionary<string, object>>(or simplyMessagePackSerializer.Deserialize<object>), and then serialize it again usingMessagePackSerializer.Serialize, the output has an extra byte.After running some tests, I realized that the difference is that a
bytedefined as an object will be encoded as auint 8zero (0xCC00), even though a plain byte is correctly encoded as apositive fixintzero (0x00).Similar results happen if instead of a
bytewe use anint, except of course it will use aint 32zero (0xD200000000).Is there a specific reason for this? Is it easily fixable or something that is more architectural on how boxing/unboxing is being handled?
Example test code:
And corresponding output:
Beta Was this translation helpful? Give feedback.
All reactions