private RpcActionInfo GetActionInternal(Type serviceType, string actionName) { var method = MethodHelper.GetActionMethod(serviceType, actionName); if (method == null) { method = MethodHelper.GetActionMethod(serviceType, "Begin" + actionName); var endMethod = MethodHelper.GetActionMethod(serviceType, "End" + actionName); if (method == null && endMethod == null) { return(null); } } if (method == null) { return(null); } var hasReturn = method.ReturnType.FullName != "System.Void"; var arguments = method.GetParameters(); var argumentType = TypeCreator.GetParameterType(method); Delegate methodFunc; var isTask = false; #if NETCORE if (method.ReturnType == typeof(Task) || (method.ReturnType.GetTypeInfo().IsGenericType&& method.ReturnType.GetTypeInfo().BaseType == typeof(Task))) #else if (method.ReturnType == typeof(Task) || (method.ReturnType.IsGenericType && method.ReturnType.BaseType == typeof(Task))) #endif { isTask = true; //isAsync = true; methodFunc = MethodHelper.GetCallMethodFunc(serviceType, argumentType, arguments, method, hasReturn); } else { //argumentType = TypeCreator.GetParameterType(method); methodFunc = MethodHelper.GetCallMethodFunc(serviceType, argumentType, arguments, method, hasReturn); } var action = new RpcActionInfo { Name = actionName, ArgumentCount = arguments.Length, ArgumentType = argumentType, DefaultArgument = GetDefaultValue(argumentType), MethodInfo = method, HasReturnValue = hasReturn, IsTask = isTask, ContractType = _contractType, }; if (isTask) { action.TaskResultType = method.ReturnType.GetGenericArguments().FirstOrDefault(); action.ResultType = action.TaskResultType; } else if (hasReturn) { action.ResultType = method.ReturnType; } else { action.ResultType = null; } return(action); }