Skip to content

Commit

Permalink
fix for unity
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Feb 1, 2022
1 parent 0528934 commit 9e38444
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ async void RunReceiveLoop(Stream pipeStream, Func<CancellationToken, System.Thre
{
var t = AsyncRequestHandlerRegistory.Get(reqTypeName, resTypeName);
var interfaceType = t.GetInterfaces().Where(x => x.IsGenericType && x.Name.StartsWith("IAsyncRequestHandler"))
.First(x => x.GetGenericArguments().Any(x => x.FullName == header.RequestType));
.First(x => x.GetGenericArguments().Any(y => y.FullName == header.RequestType));
var coreInterfaceType = t.GetInterfaces().Where(x => x.IsGenericType && x.Name.StartsWith("IAsyncRequestHandlerCore"))
.First(x => x.GetGenericArguments().Any(x => x.FullName == header.RequestType));
.First(x => x.GetGenericArguments().Any(y => y.FullName == header.RequestType));
var service = provider.GetRequiredService(interfaceType); // IAsyncRequestHandler<TRequest,TResponse>
var genericArgs = interfaceType.GetGenericArguments(); // [TRequest, TResponse]
var request = MessagePackSerializer.Deserialize(genericArgs[0], message.ValueMemory, options.MessagePackSerializerOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ async void RunReceiveLoop(SocketTcpClient client)
{
var t = AsyncRequestHandlerRegistory.Get(reqTypeName, resTypeName);
var interfaceType = t.GetInterfaces().Where(x => x.IsGenericType && x.Name.StartsWith("IAsyncRequestHandler"))
.First(x => x.GetGenericArguments().Any(x => x.FullName == header.RequestType));
.First(x => x.GetGenericArguments().Any(y => y.FullName == header.RequestType));
var coreInterfaceType = t.GetInterfaces().Where(x => x.IsGenericType && x.Name.StartsWith("IAsyncRequestHandlerCore"))
.First(x => x.GetGenericArguments().Any(x => x.FullName == header.RequestType));
.First(x => x.GetGenericArguments().Any(y => y.FullName == header.RequestType));
var service = provider.GetRequiredService(interfaceType); // IAsyncRequestHandler<TRequest,TResponse>
var genericArgs = interfaceType.GetGenericArguments(); // [TRequest, TResponse]
// Unity IL2CPP does not work(can not invoke nongenerics MessagePackSerializer)
Expand Down

0 comments on commit 9e38444

Please sign in to comment.