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

Provide example of user-defined class as RPC return type. (C#) #7

Open
starthal opened this issue Jan 27, 2016 · 2 comments
Open

Provide example of user-defined class as RPC return type. (C#) #7

starthal opened this issue Jan 27, 2016 · 2 comments

Comments

@starthal
Copy link

I am trying to call an RPC function bar() that returns a value of type Foo. Foo is an identical class on both the server and client.

The dynamic proxy always returns a MessagePackObject, and it's possible to dynamically cast this to a basic type (i.e. ulong). But a compile-time error results if I try to cast it to Foo.

I understand that a serializer for Foo can be created and registered in the SerializationContext, but this doesn't change the fact that I can't perform a cast upon the MessagePackObject returned by the call.

Is it possible to convert the return value to Foo? If it is, could someone please provide a simple example?

@ronaldpschutte
Copy link

ronaldpschutte commented Sep 28, 2017

http://cli.msgpack.org/doc/html/M_MsgPack_MessagePackObject_op_Explicit_13.htm

Remember that it is a wrapper. Unwrap it first.

@jrdmellow
Copy link

I spent several hours today digging through documentation and code for an answer to this and have had no luck. At best, the documentation is extremely lacking for both this lib and msgpack-cli and at worst it seems this repo is dead anyway...

So to any unlucky souls that arrive here after me, keep searching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants