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

Using MessagePack with SignalR on IL2CPP #973

Closed
thorgeirk11 opened this issue Jul 6, 2020 · 8 comments
Closed

Using MessagePack with SignalR on IL2CPP #973

thorgeirk11 opened this issue Jul 6, 2020 · 8 comments
Labels
Milestone

Comments

@thorgeirk11
Copy link
Contributor

Bug description

I am using Unity to create a multiplayer game using SignalR and MessagePack. I have created a Generated Resolver which works perfectly using Mono.

I am using Microsoft.AspNetCore.SignalR.Protocols.MessagePack for my client/server which has a dependency on MessagePack.dll. The issue is that If I use the base MessagePack.dll I get the following error

PlatformNotSupportedException: Operation is not supported on this platform.
  at System.Reflection.Emit.AssemblyBuilder.DefineDynamicAssembly (System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access) [0x00000] in <00000000000000000000000000000000>:0 
  at MessagePack.Internal.DynamicAssembly..ctor (System.String moduleName) [0x00000] in <00000000000000000000000000000000>:0 
  at MessagePack.Resolvers.DynamicEnumResolver..cctor () [0x00000] in <00000000000000000000000000000000>:0 
  at MessagePack.Internal.StandardResolverHelper..cctor () [0x00000] in <00000000000000000000000000000000>:0 
  at MessagePack.Resolvers.StandardResolver..cctor () [0x00000] in <00000000000000000000000000000000>:0 

I posted an issue on the asp.net github but after further investigation, I found that MessagePack has native support for Unity (IL2CPP) which inherently is not compatible with SignalR.

Is there any way for me to make these two solutions work together?

@jsteinich
Copy link
Contributor

I haven't tried with SignalR, but we have a similar situation with an internal shared library.

We have everything working, but it required building our own version of MessagePack.dll. We basically turn on the compile flags that would normally be set by Unity and build.

There have been/are a couple proposals about how to make the support better, but working around Unity's restrictions has made it tough to find an approach that meets all criteria.

@youtpout
Copy link

Same problem here I can't use MessagePack with SignalR and Unity.
@jsteinich can you share your working messagepack dll ?

@jsteinich
Copy link
Contributor

MessagePack_nuget.zip
Zip contains nuget packages.

Unity often gets mad if dll versions don't match, so those may not work for you.

@youtpout
Copy link

Thank you but I have a problem for deserialize object.
If I transport complex object the deserialization doesn't work in Unity.
I give up, i lost 3 days on unity implementation, i use the integrate serialization in SignalR who works like a charm for the moment.

@neuecc
Copy link
Member

neuecc commented Aug 5, 2020

same as #977, I'll write fixed code soon.

@thorgeirk11
Copy link
Contributor Author

@neuecc @AArnott I can verify that this issue is fixed. Is there any ETA on the next version update?

@jsteinich
Copy link
Contributor

One thing to watch out for is #931 since there is code behind a UNITY_ANDROID flag.

@AArnott AArnott added this to the v2.1 milestone Aug 12, 2020
@AArnott AArnott closed this as completed Aug 12, 2020
@AArnott
Copy link
Collaborator

AArnott commented Aug 12, 2020

I just released 2.1.165.

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

No branches or pull requests

5 participants