From ef1880ec919d825a56edff1c51c3c5bd8ae782b3 Mon Sep 17 00:00:00 2001 From: MengFanye <519730356@qq.com> Date: Thu, 8 Aug 2019 13:29:33 +0800 Subject: [PATCH] CIL binding code generator generated some code with warnings --- ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs b/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs index fde5a092..7955235a 100644 --- a/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs +++ b/ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs @@ -40,6 +40,7 @@ public static void GenerateBindingCode(List types, string outputPath, StringBuilder sb = new StringBuilder(); sb.Append(@"using System; using System.Collections.Generic; +using System.Linq; using System.Reflection; using System.Runtime.InteropServices; @@ -94,7 +95,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) sb.AppendLine(methodDef); if (hasFieldCode) sb.AppendLine(fieldDef); - if (hasMethodCode || hasFieldCode || hasCtorCode) + if (hasMethodCode || hasCtorCode) sb.AppendLine(argsDef); if (hasMethodCode || hasFieldCode || hasValueTypeCode || hasMiscCode || hasCtorCode) sb.AppendLine(typeDef); @@ -270,7 +271,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) sb.AppendLine(methodDef); if (hasFieldCode) sb.AppendLine(fieldDef); - if (hasMethodCode || hasFieldCode || hasCtorCode) + if (hasMethodCode || hasCtorCode) sb.AppendLine(argsDef); if (hasMethodCode || hasFieldCode || hasValueTypeCode || hasMiscCode || hasCtorCode) sb.AppendLine(typeDef); @@ -755,7 +756,7 @@ public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) } } - if (valueTypeBinders != null) + if (valueTypeBinders != null && valueTypeBinders.Count>0) { sb.AppendLine();