Skip to content

InvalidOperationException inside MsgPack (Do not convert System.String MessagePackObject to System.Int64.) #204

@cspwizard

Description

@cspwizard
Do not convert System.String MessagePackObject to System.Int64.    

at MsgPack.MessagePackObject.ThrowInvalidTypeAs[T](MessagePackObject instance)
   at MsgPack.MessagePackObject.AsInt64()
   at MsgPack.Serialization.DefaultSerializers.NativeDateTimeMessagePackSerializer.UnpackFromCore(Unpacker unpacker)
   at MsgPack.Serialization.MessagePackSerializer`1.UnpackFrom(Unpacker unpacker)
   at MsgPack.Serialization.MessagePackSerializer`1.Unpack(Stream stream)
   at MsgPack.Serialization.MessagePackSerializer`1.UnpackSingleObject(Byte[] buffer)
   at _HashSetSeralizationFailsAndWriteFails() in Test.cs:line 391

This issue occurs when I try to deserialize serialized string as DateTime. Here is a reproduce code:

var date = MessagePackSerializer.Get<DateTime>().UnpackSingleObject(MessagePackSerializer.Get<string>().PackSingleObject("test"))

I would expect to get standard SerializationException as MsgPack does whet I try to deserialize same serialized string as a HashSet<string> instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDetected as bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions