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