msgpack-cli
msgpack-cli copied to clipboard
Read object for fixext broken by design
Hello. Currently, I try to read fixext like a MessagePackObject, but it's not possible.
- fixext read as Binary (MessagePackObject<byte[]>) instead MessagePackObject<MessagePackExtendedTypeObject>. Some extra proves I found here https://github.com/msgpack/msgpack-cli/wiki/New-message-pack-spec .
- I can't convert to Bytes[] by AsBinary because you check string here:
An exception of type 'System.ArgumentException' occurred in MsgPack.dll but was not handled in user code: 'Do not convert System.Byte[] MessagePackObject to MsgPack.MessagePackString.'
at MsgPack.MessagePackObject.VerifyUnderlyingType[T](MessagePackObject instance, String parameterName)
What should I do for reading objects from a stream and just check the object for fixext? (in my stream I also have other types)
Thank you for feedback.
- Why do you use it so? Could you tell me a your use case or scenario?
- It is bug for type check. The message should be like `Do not convert MsgPack.MessagePackExtendedTypeObject MessagePackObject to Byte[].'
Thanks for answers.
- I should implement custom serializer over "msgpack-cli" because I have already specific lib/service in another language.
- Ok, it's logical but how I can recognize that is current object MessagePackExtendedTypeObject?
You can use MessagePackObject.IsTypeOf<MessagePackExtendedTypeObject>(). Do you use this method to implement your custom serializer?
You can use MessagePackObject.IsTypeOf<MessagePackExtendedTypeObject>()
Ohh thanks! I just skip it because I expected what
MessagePackObject.UnderlyingType == typeof(MessagePackExtendedTypeObject)
should be same as
MessagePackObject.IsTypeOf<MessagePackExtendedTypeObject>()
I confirm IsTypeOf for MessagePackExtendedTypeObject is work correctly.