You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Activity
jsteinich commentedon Jul 7, 2020
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 commentedon Jul 17, 2020
Same problem here I can't use MessagePack with SignalR and Unity.
@jsteinich can you share your working messagepack dll ?
jsteinich commentedon Jul 17, 2020
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 commentedon Jul 19, 2020
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 commentedon Aug 5, 2020
same as #977, I'll write fixed code soon.
thorgeirk11 commentedon Aug 12, 2020
@neuecc @AArnott I can verify that this issue is fixed. Is there any ETA on the next version update?
jsteinich commentedon Aug 12, 2020
One thing to watch out for is #931 since there is code behind a
UNITY_ANDROIDflag.AArnott commentedon Aug 12, 2020
I just released 2.1.165.