Skip to content

Commit

Permalink
omajinai2
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Jun 16, 2021
1 parent 617c7f1 commit 603e664
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/MessagePipe.Interprocess/Workers/TcpWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TRequest,TResponse>
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TRequest,TResponse>
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
Expand Down

0 comments on commit 603e664

Please sign in to comment.