chore: support no parameter.

oneRain 2021-03-22 17:21:04 +08:00
parent d084c92721
commit 367c57b00f
1 changed files with 4 additions and 1 deletions

View File

@ -204,7 +204,10 @@ namespace LeanCloud.Engine {
internal static async Task<object> Invoke(MethodInfo mi, object request) {
try {
object[] ps = new object[] { request };
object[] ps = null;
if (mi.GetParameters().Length > 0) {
ps = new object[] { request };
}
if (mi.ReturnType == typeof(Task) ||
(mi.ReturnType.IsGenericType && mi.ReturnType.GetGenericTypeDefinition() == typeof(Task<>))) {
Task task = mi.Invoke(null, ps) as Task;