From 603e664624248431854b7beed4e279b4d67c1912 Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 17 Jun 2021 00:46:09 +0900 Subject: [PATCH] omajinai2 --- src/MessagePipe.Interprocess/Workers/TcpWorker.cs | 1 + .../MessagePipe.Interprocess/Runtime/Workers/TcpWorker.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/MessagePipe.Interprocess/Workers/TcpWorker.cs b/src/MessagePipe.Interprocess/Workers/TcpWorker.cs index edd4791..56255fe 100644 --- a/src/MessagePipe.Interprocess/Workers/TcpWorker.cs +++ b/src/MessagePipe.Interprocess/Workers/TcpWorker.cs @@ -232,6 +232,7 @@ async void RunReceiveLoop(SocketTcpClient client) var coreInterfaceType = t.GetInterfaces().First(x => x.IsGenericType && x.Name.StartsWith("IAsyncRequestHandlerCore")); var service = provider.GetRequiredService(interfaceType); // IAsyncRequestHandler var genericArgs = interfaceType.GetGenericArguments(); // [TRequest, TResponse] + // Unity IL2CPP does not work(can not invoke nongenerics MessagePackSerializer) var request = MessagePackSerializer.Deserialize(genericArgs[0], message.ValueMemory, options.MessagePackSerializerOptions); var responseTask = coreInterfaceType.GetMethod("InvokeAsync")!.Invoke(service, new[] { request, CancellationToken.None }); #if !UNITY_2018_3_OR_NEWER diff --git a/src/MessagePipe.Unity/Assets/Plugins/MessagePipe.Interprocess/Runtime/Workers/TcpWorker.cs b/src/MessagePipe.Unity/Assets/Plugins/MessagePipe.Interprocess/Runtime/Workers/TcpWorker.cs index da4d4db..23685dc 100644 --- a/src/MessagePipe.Unity/Assets/Plugins/MessagePipe.Interprocess/Runtime/Workers/TcpWorker.cs +++ b/src/MessagePipe.Unity/Assets/Plugins/MessagePipe.Interprocess/Runtime/Workers/TcpWorker.cs @@ -232,6 +232,7 @@ async void RunReceiveLoop(SocketTcpClient client) var coreInterfaceType = t.GetInterfaces().First(x => x.IsGenericType && x.Name.StartsWith("IAsyncRequestHandlerCore")); var service = provider.GetRequiredService(interfaceType); // IAsyncRequestHandler var genericArgs = interfaceType.GetGenericArguments(); // [TRequest, TResponse] + // Unity IL2CPP does not work(can not invoke nongenerics MessagePackSerializer) var request = MessagePackSerializer.Deserialize(genericArgs[0], message.ValueMemory, options.MessagePackSerializerOptions); var responseTask = coreInterfaceType.GetMethod("InvokeAsync").Invoke(service, new[] { request, CancellationToken.None }); #if !UNITY_2018_3_OR_NEWER