using (var ms = new MemoryStream())
{
var packer = Packer.Create(ms, PackerCompatibilityOptions.None);
packer.PackObject(Guid.NewGuid());
}
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).
If you use the following code to serialize a GUID value:
I will get the following result:
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.Nonethe 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?)