dahomey-technologies/Dahomey.Cbor

Deserialize an array into Tuple

Odonno opened this issue · 2 comments

Deserializing a CBOR array into a Tuple doesn't seem to work.

Here is a concrete example:

CBOR hexa value: 82664c6f6e646f6e1907e7
CBOR notation: ["London", 2023_1]

The following should deserialize into a Tuple but it currently throws an exception:

var value = Cbor.Deserialize<(string, int)>("82664c6f6e646f6e1907e7".HexaToBinary());

The thrown exception:

Dahomey.Cbor.CborException : [1] Expected major type Map (5)
  Arborescence des appels de procédure :
     at Dahomey.Cbor.Serialization.CborReader.ThrowCbor(String message) in C:\test\Dahomey.Cbor\src\Dahomey.Cbor\Serialization\CborReader.cs:line 1081
   at Dahomey.Cbor.Serialization.Converters.ObjectConverter`1.Read(CborReader& reader) in C:\test\Dahomey.Cbor\src\Dahomey.Cbor\Serialization\Converters\ObjectConverter.cs:line 184

reproduced

Thank you Michaël