diff --git a/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs b/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs index 4f42b809..8aafdebb 100755 --- a/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs +++ b/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs @@ -648,8 +648,8 @@ internal static List GenerateDelegateBinding(List types, string ou { var mi = i.GetMethod("Invoke"); var miParameters = mi.GetParameters(); - if (mi.ReturnType == typeof(void) && miParameters.Length == 0) - continue; + //if (mi.ReturnType == typeof(void) && miParameters.Length == 0) + // continue; string clsName, realClsName, paramClsName, paramRealClsName; bool isByRef, paramIsByRef; @@ -704,8 +704,9 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) mi.ReturnType.GetClassName(out paramClsName, out paramRealClsName, out paramIsByRef); sb.Append(paramRealClsName); sb.AppendLine("> ();"); + sb.AppendLine(); } - else + else if (miParameters.Length != 0) { sb.Append(" app.DelegateManager.RegisterMethodDelegate<"); first = true; @@ -721,8 +722,8 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) sb.Append(paramRealClsName); } sb.AppendLine("> ();"); + sb.AppendLine(); } - sb.AppendLine(); sb.Append(" app.DelegateManager.RegisterDelegateConvertor<"); sb.Append(realClsName); @@ -763,10 +764,14 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) sb.Append(", "); mi.ReturnType.GetClassName(out paramClsName, out paramRealClsName, out paramIsByRef); sb.Append(paramRealClsName); + sb.Append(">)act)("); } else { - sb.Append(" ((Action<"); + if (miParameters.Length != 0) + sb.Append(" ((Action<"); + else + sb.Append(" ((Action"); first = true; foreach (var j in miParameters) { @@ -779,8 +784,11 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) j.ParameterType.GetClassName(out paramClsName, out paramRealClsName, out paramIsByRef); sb.Append(paramRealClsName); } + if (miParameters.Length != 0) + sb.Append(">)act)("); + else + sb.Append(")act)("); } - sb.Append(">)act)("); first = true; foreach (var j in miParameters) {