From f90bafe6976c11192173a2384ad6cc19262e455a Mon Sep 17 00:00:00 2001 From: chenxihan <39304431+chenxihan@users.noreply.github.com> Date: Wed, 28 Sep 2022 13:49:25 +0800 Subject: [PATCH 1/5] Update Extensions.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CLR绑定:函数参数有多维数组报错修改 NullReferenceException: Object reference not set to an instance of an object ILRuntime.CLR.TypeSystem.ILType.CheckGenericParams (ILRuntime.CLR.Method.ILMethod i, System.Collections.Generic.List`1[T] param, ILRuntime.CLR.TypeSystem.IType[] genericArguments, System.Boolean& match) (at Library/PackageCache/com.ourpalm.ilruntime@2.0.2/CLR/TypeSystem/ILType.cs:929) --- ILRuntime/CLR/Utils/Extensions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ILRuntime/CLR/Utils/Extensions.cs b/ILRuntime/CLR/Utils/Extensions.cs index 2508710e..13e30c24 100644 --- a/ILRuntime/CLR/Utils/Extensions.cs +++ b/ILRuntime/CLR/Utils/Extensions.cs @@ -53,6 +53,10 @@ public static List GetParamList(this MethodReference def, ILRuntime.Runti { name = t.FullName + "[]"; } + else if (name == gp.Name + "[0...,0...]") + { + name = t.FullName + "[,]"; + } else { /*name = name.Replace("<" + gp.Name + ">", "<" + ga.FullName + ">"); From 9bc08562fd26bf2827613c9a757fa5ab8e1569a6 Mon Sep 17 00:00:00 2001 From: hans <39304431+chenxihan@users.noreply.github.com> Date: Fri, 7 Oct 2022 22:56:47 +0800 Subject: [PATCH 2/5] =?UTF-8?q?CLR=E7=BB=91=E5=AE=9A=E5=A4=9A=E7=BB=B4?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E5=8F=82=E6=95=B0=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ILRuntime/CLR/Utils/Extensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ILRuntime/CLR/Utils/Extensions.cs b/ILRuntime/CLR/Utils/Extensions.cs index 13e30c24..c419f8de 100644 --- a/ILRuntime/CLR/Utils/Extensions.cs +++ b/ILRuntime/CLR/Utils/Extensions.cs @@ -49,11 +49,12 @@ public static List GetParamList(this MethodReference def, ILRuntime.Runti t = appdomain.GetType(ga, contextType, contextMethod); if (t == null && genericArguments != null) t = genericArguments[j]; - if (name == gp.Name + "[]") + int nameLength = gp.Name.Length; + if (name == nameLength + 2 && name.StartWith(gp.Name) && name.EndWith("[]")) { name = t.FullName + "[]"; } - else if (name == gp.Name + "[0...,0...]") + else if (name.Length == nameLength + 11 && name.StartWith(gp.Name) && name.EndWith("[0...,0...]")) { name = t.FullName + "[,]"; } From dfba168a35eb4b8c990159012c103768932348e3 Mon Sep 17 00:00:00 2001 From: hans <39304431+chenxihan@users.noreply.github.com> Date: Fri, 7 Oct 2022 23:05:34 +0800 Subject: [PATCH 3/5] Update Extensions.cs --- ILRuntime/CLR/Utils/Extensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ILRuntime/CLR/Utils/Extensions.cs b/ILRuntime/CLR/Utils/Extensions.cs index c419f8de..d80150f2 100644 --- a/ILRuntime/CLR/Utils/Extensions.cs +++ b/ILRuntime/CLR/Utils/Extensions.cs @@ -54,7 +54,7 @@ public static List GetParamList(this MethodReference def, ILRuntime.Runti { name = t.FullName + "[]"; } - else if (name.Length == nameLength + 11 && name.StartWith(gp.Name) && name.EndWith("[0...,0...]")) + else if (name.Length == nameLength + 11 && name.StartsWith(gp.Name) && name.EndsWith("[0...,0...]")) { name = t.FullName + "[,]"; } From 05eecd89fa5a03112160c6870ccf5972a34653b7 Mon Sep 17 00:00:00 2001 From: hans <39304431+chenxihan@users.noreply.github.com> Date: Fri, 7 Oct 2022 23:08:17 +0800 Subject: [PATCH 4/5] Update Extensions.cs --- ILRuntime/CLR/Utils/Extensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ILRuntime/CLR/Utils/Extensions.cs b/ILRuntime/CLR/Utils/Extensions.cs index d80150f2..12e915a6 100644 --- a/ILRuntime/CLR/Utils/Extensions.cs +++ b/ILRuntime/CLR/Utils/Extensions.cs @@ -50,7 +50,7 @@ public static List GetParamList(this MethodReference def, ILRuntime.Runti if (t == null && genericArguments != null) t = genericArguments[j]; int nameLength = gp.Name.Length; - if (name == nameLength + 2 && name.StartWith(gp.Name) && name.EndWith("[]")) + if (name.Length == nameLength + 2 && name.StartWith(gp.Name) && name.EndWith("[]")) { name = t.FullName + "[]"; } From 39b68698707618b08b4c8cda41431deb8c9a8314 Mon Sep 17 00:00:00 2001 From: hans <39304431+chenxihan@users.noreply.github.com> Date: Sat, 8 Oct 2022 09:11:12 +0800 Subject: [PATCH 5/5] Update Extensions.cs --- ILRuntime/CLR/Utils/Extensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ILRuntime/CLR/Utils/Extensions.cs b/ILRuntime/CLR/Utils/Extensions.cs index 12e915a6..0732ba7b 100644 --- a/ILRuntime/CLR/Utils/Extensions.cs +++ b/ILRuntime/CLR/Utils/Extensions.cs @@ -50,7 +50,7 @@ public static List GetParamList(this MethodReference def, ILRuntime.Runti if (t == null && genericArguments != null) t = genericArguments[j]; int nameLength = gp.Name.Length; - if (name.Length == nameLength + 2 && name.StartWith(gp.Name) && name.EndWith("[]")) + if (name.Length == nameLength + 2 && name.StartsWith(gp.Name) && name.EndsWith("[]")) { name = t.FullName + "[]"; }