Message Pack : Do not convert System.Boolean (binary:0x0) MessagePackObject to System.Int64

855 views Asked by At

We get following error while unpacking packed message to an object. This error is not noticed on local development environment (windows 7) but occurs in the server environment. (server 2008).

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.Serialization.SerializationException: The unpacked value is not expected type. Do not convert System.Boolean (binary:0x0) MessagePackObject to System.Int64. ---> System.InvalidOperationException: Do not convert System.Boolean (binary:0x0) MessagePackObject to System.Int64.
at MsgPack.MessagePackObject.ThrowInvalidTypeAsT
at MsgPack.MessagePackObject.AsInt64()
at MsgPack.Serialization.DefaultSerializers.System_DateTimeMessagePackSerializer.UnpackFromCore(Unpacker unpacker)
--- End of inner exception stack trace ---
at MsgPack.Serialization.DefaultSerializers.System_DateTimeMessagePackSerializer.UnpackFromCore(Unpacker unpacker)
at MsgPack.Serialization.DefaultSerializers.NullableMessagePackSerializer1.UnpackFromCore(Unpacker unpacker) at MsgPack.Serialization.MessagePackSerializer1.UnpackFrom(Unpacker unpacker)

Edited: More details about the issue: We have two environments (Local & Central). We are trying to send an object converted to message pack from local over the TCP socket and unpack back to object on the central.

We tried to deploy both Local application and Central Tcp listener on two different Windows 7 machines and we have no problem in upacking the data at the Central. But when we try to deploy Local on Windows7 machine and Central on Windows 2008 server (Which would be actual production scenario) we have this issue. In both the scenarios I am packing and unpacking the same object with same data through test application. We are still unable to find the root cause of the issue.

Are we missing anything?

1

There are 1 answers

2
Laurence Adams On

You're obviously attempting to convert a boolean to an int64, which is an invalid conversion. Perhaps you do not observe it in your dev environment because the the message you are unpacking to an object is different than the message being unpacked in your production environment.

You need to insure your inputs are the same in Dev and and Live, and then proceed from there.