msgpack / msgpack-cli

MessagePack implementation for Common Language Infrastructure / msgpack.org[C#]
http://msgpack.org
Apache License 2.0
835 stars 175 forks source link

Unpacker throws exception trying to read map length after IsMapHeader returns true #320

Open ebekker opened 5 years ago

ebekker commented 5 years ago

I've implemented a custom MessagePackSerializer, and when trying to deserialize my type from the byte stream, which is expected to be a Map, I get an exception.

At the point of the exception unpacker.IsMapHeader returns true, but trying to do unpacker.ReadMapLength(...) throws: MsgPack.MessageTypeException: Cannot convert 'map' header from type 'FixedRaw'(0xA6) in position 1.

ebekker commented 5 years ago

A sample of the byte stream:

[138,166,97,112,112,101,110,100,144,168,99,104,101,99,107,115,117,109,192,176,99,111,109,112,117,116,101,95,99,104,101,99,107,115,117,109,163,109,100,53,167,99,111,110,116,101,110,116,217,39,84,104,105,115,32,105,115,32,99,111,110,116,101,110,116,32,102,114,111,109,32,105,110,108,105,110,101,32,84,70,32,99,111,110,102,105,103,46,10,174,99,111,110,116,101,110,116,95,98,97,115,101,54,52,192,172,99,111,110,116,101,110,116,95,112,97,116,104,192,171,99,111,110,116,101,110,116,95,117,114,108,192,169,102,117,108,108,95,112,97,116,104,192,173,108,97,115,116,95,109,111,100,105,102,105,101,100,192,164,112,97,116,104,171,46,47,116,101,115,116,49,46,116,120,116]