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?
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.
Same problem here I can't use MessagePack with SignalR and Unity.
@jsteinich can you share your working messagepack dll ?
MessagePack_nuget.zip
Zip contains nuget packages.
Unity often gets mad if dll versions don't match, so those may not work for you.
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.
same as #977, I'll write fixed code soon.
@neuecc @AArnott I can verify that this issue is fixed. Is there any ETA on the next version update?
One thing to watch out for is https://github.com/neuecc/MessagePack-CSharp/issues/931 since there is code behind a UNITY_ANDROID flag.
I just released 2.1.165.
Most helpful comment
@neuecc @AArnott I can verify that this issue is fixed. Is there any ETA on the next version update?