A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/msgpack/msgpack-cli/issues/270 below:

Guids serialized as strings even though the compatibility option is set to None · Issue #270 · msgpack/msgpack-cli · GitHub

If you use the following code to serialize a GUID value:

using (var ms = new MemoryStream())
{
    var packer = Packer.Create(ms, PackerCompatibilityOptions.None);
    packer.PackObject(Guid.NewGuid());
}

I will get the following result:

0xb0, 0x49, 0x92, 0xa0, 0x7d, 0xb2, 0x98, 0xfe, 0x4a, 0x97, 0xfe, 0xaf, 0xd9, 0xae, 0x91, 0x0e, 0x49, 0xb0, 0x2d, 0xd9, 0x75, 0xb6, 0x94, 0xa0, 0x5d, 0x4c, 0xb4, 0x4c, 0xe0, 0xd5, 0xad, 0x55, 0xeb, 0x67

so, the binary array representing the GUID has been serialized as a string of 15 characters (0xb0). My expectation was that because I used PackerCompatibilityOptions.None the byte array for GUID will be serialized as bin8 family (0xc4).

Looking at the code it seems that binX family is never considered when packing raw values. I would like to understand why this is the case and how raw values are typically unpacked if the language does not have strong type system (e.g. in JavaScript this GUID will be unpacked as string - is it then the user's responsibility to extract bytes?)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4