Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read object for fixext broken by design #269

Open
stalkerg opened this issue Oct 31, 2017 · 5 comments
Open

Read object for fixext broken by design #269

stalkerg opened this issue Oct 31, 2017 · 5 comments
Labels
bug Detected as bug need-more-info Need more information (error message, stack trace, repro code etc) question

Comments

@stalkerg
Copy link

stalkerg commented Oct 31, 2017

Hello.
Currently, I try to read fixext like a MessagePackObject, but it's not possible.

  1. 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 .
  2. 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)

@yfakariya yfakariya added bug Detected as bug need-more-info Need more information (error message, stack trace, repro code etc) question labels Nov 5, 2017
@yfakariya
Copy link
Member

Thank you for feedback.

  1. Why do you use it so? Could you tell me a your use case or scenario?
  2. It is bug for type check. The message should be like `Do not convert MsgPack.MessagePackExtendedTypeObject MessagePackObject to Byte[].'

@stalkerg
Copy link
Author

stalkerg commented Nov 5, 2017

Thanks for answers.

  1. I should implement custom serializer over "msgpack-cli" because I have already specific lib/service in another language.
  2. Ok, it's logical but how I can recognize that is current object MessagePackExtendedTypeObject?

@yfakariya
Copy link
Member

You can use MessagePackObject.IsTypeOf<MessagePackExtendedTypeObject>(). Do you use this method to implement your custom serializer?

yfakariya added a commit that referenced this issue Nov 6, 2017
yfakariya added a commit that referenced this issue Nov 6, 2017
@stalkerg
Copy link
Author

stalkerg commented Nov 6, 2017

You can use MessagePackObject.IsTypeOf()

Ohh thanks! I just skip it because I expected what

MessagePackObject.UnderlyingType == typeof(MessagePackExtendedTypeObject)

should be same as

MessagePackObject.IsTypeOf<MessagePackExtendedTypeObject>()

@stalkerg
Copy link
Author

stalkerg commented Nov 6, 2017

I confirm IsTypeOf for MessagePackExtendedTypeObject is work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Detected as bug need-more-info Need more information (error message, stack trace, repro code etc) question
Projects
None yet
Development

No branches or pull requests

2 participants