public override CallResult SendCall(CallInfo info) { var tcs = new TaskCompletionSource <CallResult>(); mWaitingCalls.TryAdd(info.CallID, tcs); var method = info.GetMethodInfo(); for (int i = 0; i < info.Args.Length; i++) { var declaredType = method.GetParameters()[i].ParameterType; if (declaredType == info.Args[i].GetType()) { continue; } var declarationWrapper = new DeclarationWrapper(info.Args[i], declaredType); info.Args[i] = declarationWrapper; } SendData(info); mContext.Wait(tcs.Task); var result = tcs.Task.Result; result.Result = SuperJsonSerializer.ConvertResult(result.Result, method.ReturnType); return(result); }