Ver Fonte

修复IL2CPP下加载Protobuf的bug
IL2CPP模式下,CodeMode自动设置成ILRuntime模式

tanghai há 4 anos atrás
pai
commit
86244deb0a

+ 0 - 7
Unity/Assets/Editor/BuildEditor/BuildHelper.cs

@@ -11,13 +11,6 @@ namespace ET
 
 
         public static string BuildFolder = "../Release/{0}/StreamingAssets/";
         public static string BuildFolder = "../Release/{0}/StreamingAssets/";
 
 
-
-        [MenuItem("Tools/web资源服务器")]
-        public static void OpenFileServer()
-        {
-            ProcessHelper.Run("dotnet", "FileServer.dll", "../FileServer/");
-        }
-
         public static void Build(PlatformType type, BuildAssetBundleOptions buildAssetBundleOptions, BuildOptions buildOptions, bool isBuildExe, bool isContainAB, bool clearFolder)
         public static void Build(PlatformType type, BuildAssetBundleOptions buildAssetBundleOptions, BuildOptions buildOptions, bool isBuildExe, bool isContainAB, bool clearFolder)
         {
         {
             BuildTarget buildTarget = BuildTarget.StandaloneWindows;
             BuildTarget buildTarget = BuildTarget.StandaloneWindows;

+ 6 - 32
Unity/Assets/Mono/ILRuntime/Generate/ET_AsyncETVoidMethodBuilder_Binding.cs

@@ -76,9 +76,6 @@ namespace ILRuntime.Runtime.Generated
             args = new Type[]{};
             args = new Type[]{};
             method = type.GetMethod("SetResult", flag, null, args, null);
             method = type.GetMethod("SetResult", flag, null, args, null);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
-            args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)};
-            method = type.GetMethod("SetStateMachine", flag, null, args, null);
-            app.RegisterCLRMethodRedirection(method, SetStateMachine_6);
             args = new Type[]{typeof(ET.ETTask<System.Int32>), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
             args = new Type[]{typeof(ET.ETTask<System.Int32>), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
             if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
             if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
             {
             {
@@ -87,7 +84,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<System.Int32>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<System.Int32>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6);
 
 
                         break;
                         break;
                     }
                     }
@@ -101,7 +98,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTaskCompleted).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTaskCompleted).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_8);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7);
 
 
                         break;
                         break;
                     }
                     }
@@ -115,7 +112,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<ILRuntime.Runtime.Intepreter.ILTypeInstance>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<ILRuntime.Runtime.Intepreter.ILTypeInstance>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_9);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_8);
 
 
                         break;
                         break;
                     }
                     }
@@ -457,30 +454,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* SetStateMachine_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(__esp, 2);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
-            System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
-            __intp.Free(ptr_of_this_method);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
-            ET.AsyncETVoidMethodBuilder instance_of_this_method = (ET.AsyncETVoidMethodBuilder)typeof(ET.AsyncETVoidMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
-
-            instance_of_this_method.SetStateMachine(@stateMachine);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
-
-            __intp.Free(ptr_of_this_method);
-            return __ret;
-        }
-
-        static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;
@@ -615,7 +589,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* AwaitUnsafeOnCompleted_8(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;
@@ -750,7 +724,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* AwaitUnsafeOnCompleted_9(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_8(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;

+ 0 - 26
Unity/Assets/Mono/ILRuntime/Generate/ET_ETAsyncTaskMethodBuilder_1_AssetBundle_Binding.cs

@@ -76,9 +76,6 @@ namespace ILRuntime.Runtime.Generated
             args = new Type[]{typeof(UnityEngine.AssetBundle)};
             args = new Type[]{typeof(UnityEngine.AssetBundle)};
             method = type.GetMethod("SetResult", flag, null, args, null);
             method = type.GetMethod("SetResult", flag, null, args, null);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
-            args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)};
-            method = type.GetMethod("SetStateMachine", flag, null, args, null);
-            app.RegisterCLRMethodRedirection(method, SetStateMachine_6);
 
 
             app.RegisterCLRCreateDefaultInstance(type, () => new ET.ETAsyncTaskMethodBuilder<UnityEngine.AssetBundle>());
             app.RegisterCLRCreateDefaultInstance(type, () => new ET.ETAsyncTaskMethodBuilder<UnityEngine.AssetBundle>());
 
 
@@ -417,29 +414,6 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* SetStateMachine_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(__esp, 2);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
-            System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
-            __intp.Free(ptr_of_this_method);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
-            ET.ETAsyncTaskMethodBuilder<UnityEngine.AssetBundle> instance_of_this_method = (ET.ETAsyncTaskMethodBuilder<UnityEngine.AssetBundle>)typeof(ET.ETAsyncTaskMethodBuilder<UnityEngine.AssetBundle>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
-
-            instance_of_this_method.SetStateMachine(@stateMachine);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
-
-            __intp.Free(ptr_of_this_method);
-            return __ret;
-        }
-
 
 
 
 
     }
     }

+ 0 - 26
Unity/Assets/Mono/ILRuntime/Generate/ET_ETAsyncTaskMethodBuilder_1_Boolean_Binding.cs

@@ -76,9 +76,6 @@ namespace ILRuntime.Runtime.Generated
             args = new Type[]{typeof(System.Boolean)};
             args = new Type[]{typeof(System.Boolean)};
             method = type.GetMethod("SetResult", flag, null, args, null);
             method = type.GetMethod("SetResult", flag, null, args, null);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
-            args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)};
-            method = type.GetMethod("SetStateMachine", flag, null, args, null);
-            app.RegisterCLRMethodRedirection(method, SetStateMachine_6);
 
 
             app.RegisterCLRCreateDefaultInstance(type, () => new ET.ETAsyncTaskMethodBuilder<System.Boolean>());
             app.RegisterCLRCreateDefaultInstance(type, () => new ET.ETAsyncTaskMethodBuilder<System.Boolean>());
 
 
@@ -416,29 +413,6 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* SetStateMachine_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(__esp, 2);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
-            System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
-            __intp.Free(ptr_of_this_method);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
-            ET.ETAsyncTaskMethodBuilder<System.Boolean> instance_of_this_method = (ET.ETAsyncTaskMethodBuilder<System.Boolean>)typeof(ET.ETAsyncTaskMethodBuilder<System.Boolean>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
-
-            instance_of_this_method.SetStateMachine(@stateMachine);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
-
-            __intp.Free(ptr_of_this_method);
-            return __ret;
-        }
-
 
 
 
 
     }
     }

+ 8 - 34
Unity/Assets/Mono/ILRuntime/Generate/ET_ETAsyncTaskMethodBuilder_1_ILTypeInstance_Binding.cs

@@ -76,9 +76,6 @@ namespace ILRuntime.Runtime.Generated
             args = new Type[]{typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance)};
             args = new Type[]{typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance)};
             method = type.GetMethod("SetResult", flag, null, args, null);
             method = type.GetMethod("SetResult", flag, null, args, null);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
-            args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)};
-            method = type.GetMethod("SetStateMachine", flag, null, args, null);
-            app.RegisterCLRMethodRedirection(method, SetStateMachine_6);
             args = new Type[]{typeof(ET.ETTask<ILRuntime.Runtime.Intepreter.ILTypeInstance>), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
             args = new Type[]{typeof(ET.ETTask<ILRuntime.Runtime.Intepreter.ILTypeInstance>), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
             if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
             if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
             {
             {
@@ -87,7 +84,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<ILRuntime.Runtime.Intepreter.ILTypeInstance>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<ILRuntime.Runtime.Intepreter.ILTypeInstance>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6);
 
 
                         break;
                         break;
                     }
                     }
@@ -101,7 +98,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTaskCompleted).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTaskCompleted).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_8);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7);
 
 
                         break;
                         break;
                     }
                     }
@@ -115,7 +112,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<System.Boolean>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<System.Boolean>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_9);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_8);
 
 
                         break;
                         break;
                     }
                     }
@@ -129,7 +126,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<UnityEngine.AssetBundle>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<UnityEngine.AssetBundle>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_10);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_9);
 
 
                         break;
                         break;
                     }
                     }
@@ -473,30 +470,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* SetStateMachine_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(__esp, 2);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
-            System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
-            __intp.Free(ptr_of_this_method);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
-            ET.ETAsyncTaskMethodBuilder<ILRuntime.Runtime.Intepreter.ILTypeInstance> instance_of_this_method = (ET.ETAsyncTaskMethodBuilder<ILRuntime.Runtime.Intepreter.ILTypeInstance>)typeof(ET.ETAsyncTaskMethodBuilder<ILRuntime.Runtime.Intepreter.ILTypeInstance>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
-
-            instance_of_this_method.SetStateMachine(@stateMachine);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
-
-            __intp.Free(ptr_of_this_method);
-            return __ret;
-        }
-
-        static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;
@@ -631,7 +605,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* AwaitUnsafeOnCompleted_8(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;
@@ -766,7 +740,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* AwaitUnsafeOnCompleted_9(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_8(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;
@@ -901,7 +875,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* AwaitUnsafeOnCompleted_10(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_9(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;

+ 0 - 26
Unity/Assets/Mono/ILRuntime/Generate/ET_ETAsyncTaskMethodBuilder_1_Int32_Binding.cs

@@ -76,9 +76,6 @@ namespace ILRuntime.Runtime.Generated
             args = new Type[]{typeof(System.Int32)};
             args = new Type[]{typeof(System.Int32)};
             method = type.GetMethod("SetResult", flag, null, args, null);
             method = type.GetMethod("SetResult", flag, null, args, null);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
-            args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)};
-            method = type.GetMethod("SetStateMachine", flag, null, args, null);
-            app.RegisterCLRMethodRedirection(method, SetStateMachine_6);
 
 
             app.RegisterCLRCreateDefaultInstance(type, () => new ET.ETAsyncTaskMethodBuilder<System.Int32>());
             app.RegisterCLRCreateDefaultInstance(type, () => new ET.ETAsyncTaskMethodBuilder<System.Int32>());
 
 
@@ -416,29 +413,6 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* SetStateMachine_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(__esp, 2);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
-            System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
-            __intp.Free(ptr_of_this_method);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
-            ET.ETAsyncTaskMethodBuilder<System.Int32> instance_of_this_method = (ET.ETAsyncTaskMethodBuilder<System.Int32>)typeof(ET.ETAsyncTaskMethodBuilder<System.Int32>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
-
-            instance_of_this_method.SetStateMachine(@stateMachine);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
-
-            __intp.Free(ptr_of_this_method);
-            return __ret;
-        }
-
 
 
 
 
     }
     }

+ 0 - 26
Unity/Assets/Mono/ILRuntime/Generate/ET_ETAsyncTaskMethodBuilder_1_Object_Array_Binding.cs

@@ -76,9 +76,6 @@ namespace ILRuntime.Runtime.Generated
             args = new Type[]{typeof(UnityEngine.Object[])};
             args = new Type[]{typeof(UnityEngine.Object[])};
             method = type.GetMethod("SetResult", flag, null, args, null);
             method = type.GetMethod("SetResult", flag, null, args, null);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
-            args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)};
-            method = type.GetMethod("SetStateMachine", flag, null, args, null);
-            app.RegisterCLRMethodRedirection(method, SetStateMachine_6);
 
 
             app.RegisterCLRCreateDefaultInstance(type, () => new ET.ETAsyncTaskMethodBuilder<UnityEngine.Object[]>());
             app.RegisterCLRCreateDefaultInstance(type, () => new ET.ETAsyncTaskMethodBuilder<UnityEngine.Object[]>());
 
 
@@ -417,29 +414,6 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* SetStateMachine_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(__esp, 2);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
-            System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
-            __intp.Free(ptr_of_this_method);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
-            ET.ETAsyncTaskMethodBuilder<UnityEngine.Object[]> instance_of_this_method = (ET.ETAsyncTaskMethodBuilder<UnityEngine.Object[]>)typeof(ET.ETAsyncTaskMethodBuilder<UnityEngine.Object[]>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
-
-            instance_of_this_method.SetStateMachine(@stateMachine);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
-
-            __intp.Free(ptr_of_this_method);
-            return __ret;
-        }
-
 
 
 
 
     }
     }

+ 10 - 36
Unity/Assets/Mono/ILRuntime/Generate/ET_ETAsyncTaskMethodBuilder_Binding.cs

@@ -76,9 +76,6 @@ namespace ILRuntime.Runtime.Generated
             args = new Type[]{};
             args = new Type[]{};
             method = type.GetMethod("SetResult", flag, null, args, null);
             method = type.GetMethod("SetResult", flag, null, args, null);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
             app.RegisterCLRMethodRedirection(method, SetResult_5);
-            args = new Type[]{typeof(System.Runtime.CompilerServices.IAsyncStateMachine)};
-            method = type.GetMethod("SetStateMachine", flag, null, args, null);
-            app.RegisterCLRMethodRedirection(method, SetStateMachine_6);
             args = new Type[]{typeof(ET.ETTask), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
             args = new Type[]{typeof(ET.ETTask), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
             if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
             if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
             {
             {
@@ -87,7 +84,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6);
 
 
                         break;
                         break;
                     }
                     }
@@ -101,7 +98,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(System.Runtime.CompilerServices.TaskAwaiter).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(System.Runtime.CompilerServices.TaskAwaiter).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_8);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7);
 
 
                         break;
                         break;
                     }
                     }
@@ -115,7 +112,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTaskCompleted).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTaskCompleted).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_9);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_8);
 
 
                         break;
                         break;
                     }
                     }
@@ -129,7 +126,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<System.Boolean>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<System.Boolean>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_10);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_9);
 
 
                         break;
                         break;
                     }
                     }
@@ -143,7 +140,7 @@ namespace ILRuntime.Runtime.Generated
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<UnityEngine.Object[]>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     if(m.MatchGenericParameters(args, typeof(void), typeof(ET.ETTask<UnityEngine.Object[]>).MakeByRefType(), typeof(ET.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
                     {
                     {
                         method = m.MakeGenericMethod(args);
                         method = m.MakeGenericMethod(args);
-                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_11);
+                        app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_10);
 
 
                         break;
                         break;
                     }
                     }
@@ -483,30 +480,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* SetStateMachine_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(__esp, 2);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
-            System.Runtime.CompilerServices.IAsyncStateMachine @stateMachine = (System.Runtime.CompilerServices.IAsyncStateMachine)typeof(System.Runtime.CompilerServices.IAsyncStateMachine).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
-            __intp.Free(ptr_of_this_method);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
-            ET.ETAsyncTaskMethodBuilder instance_of_this_method = (ET.ETAsyncTaskMethodBuilder)typeof(ET.ETAsyncTaskMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
-
-            instance_of_this_method.SetStateMachine(@stateMachine);
-
-            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
-            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
-
-            __intp.Free(ptr_of_this_method);
-            return __ret;
-        }
-
-        static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;
@@ -641,7 +615,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* AwaitUnsafeOnCompleted_8(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;
@@ -776,7 +750,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* AwaitUnsafeOnCompleted_9(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_8(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;
@@ -911,7 +885,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* AwaitUnsafeOnCompleted_10(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_9(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;
@@ -1046,7 +1020,7 @@ namespace ILRuntime.Runtime.Generated
             return __ret;
             return __ret;
         }
         }
 
 
-        static StackObject* AwaitUnsafeOnCompleted_11(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
+        static StackObject* AwaitUnsafeOnCompleted_10(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
         {
         {
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
             StackObject* ptr_of_this_method;
             StackObject* ptr_of_this_method;

+ 4 - 7
Unity/Assets/Mono/ILRuntime/ILHelper.cs

@@ -2,11 +2,6 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.IO;
 using System.IO;
 using System.Net;
 using System.Net;
-using System.Reflection;
-using ILRuntime.CLR.Method;
-using ILRuntime.CLR.TypeSystem;
-using ILRuntime.Runtime.Enviorment;
-//using ILRuntime.Runtime.Generated;
 using ILRuntime.Runtime.Intepreter;
 using ILRuntime.Runtime.Intepreter;
 using ProtoBuf;
 using ProtoBuf;
 using UnityEngine;
 using UnityEngine;
@@ -20,6 +15,8 @@ namespace ET
         public static void InitILRuntime(ILRuntime.Runtime.Enviorment.AppDomain appdomain)
         public static void InitILRuntime(ILRuntime.Runtime.Enviorment.AppDomain appdomain)
         {
         {
             list.Add(typeof(Dictionary<int, ILTypeInstance>));
             list.Add(typeof(Dictionary<int, ILTypeInstance>));
+            list.Add(typeof(Dictionary<long, ILTypeInstance>));
+            list.Add(typeof(Dictionary<string, ILTypeInstance>));
             list.Add(typeof(Dictionary<int, int>));
             list.Add(typeof(Dictionary<int, int>));
             list.Add(typeof(Dictionary<object, object>));
             list.Add(typeof(Dictionary<object, object>));
             list.Add(typeof(Dictionary<int, object>));
             list.Add(typeof(Dictionary<int, object>));
@@ -34,13 +31,13 @@ namespace ET
             list.Add(typeof(List<long>));
             list.Add(typeof(List<long>));
             list.Add(typeof(List<string>));
             list.Add(typeof(List<string>));
             list.Add(typeof(List<object>));
             list.Add(typeof(List<object>));
-            list.Add(typeof(ListComponent<ILTypeInstance>));
             list.Add(typeof(ETTask<int>));
             list.Add(typeof(ETTask<int>));
             list.Add(typeof(ETTask<long>));
             list.Add(typeof(ETTask<long>));
             list.Add(typeof(ETTask<string>));
             list.Add(typeof(ETTask<string>));
             list.Add(typeof(ETTask<object>));
             list.Add(typeof(ETTask<object>));
             list.Add(typeof(ETTask<AssetBundle>));
             list.Add(typeof(ETTask<AssetBundle>));
             list.Add(typeof(ETTask<UnityEngine.Object[]>));
             list.Add(typeof(ETTask<UnityEngine.Object[]>));
+            list.Add(typeof(ListComponent<ILTypeInstance>));
             list.Add(typeof(ListComponent<ETTask>));
             list.Add(typeof(ListComponent<ETTask>));
             list.Add(typeof(ListComponent<Vector3>));
             list.Add(typeof(ListComponent<Vector3>));
             
             
@@ -105,7 +102,7 @@ namespace ET
             {
             {
                 t.GetMethod("Initialize")?.Invoke(null, new object[] { appdomain });
                 t.GetMethod("Initialize")?.Invoke(null, new object[] { appdomain });
             }
             }
-            // CLRBindings.Initialize(appdomain);
+            //ILRuntime.Runtime.Generated.CLRBindings.Initialize(appdomain);
         }
         }
         
         
         public static void RegisterAdaptor(ILRuntime.Runtime.Enviorment.AppDomain appdomain)
         public static void RegisterAdaptor(ILRuntime.Runtime.Enviorment.AppDomain appdomain)

+ 5 - 1
Unity/Assets/Mono/MonoBehaviour/Init.cs

@@ -17,12 +17,16 @@ namespace ET
 		
 		
 		private CodeLoader codeLoader;
 		private CodeLoader codeLoader;
 
 
-		public CodeMode CodeMode = CodeMode.ILRuntime;
+		public CodeMode CodeMode = CodeMode.Mono;
 		
 		
 		private void Awake()
 		private void Awake()
 		{
 		{
 			Instance = this;
 			Instance = this;
 			
 			
+#if ENABLE_IL2CPP
+			this.CodeMode = CodeMode.ILRuntime;
+#endif
+			
 			System.AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
 			System.AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
 			{
 			{
 				Log.Error(e.ExceptionObject.ToString());
 				Log.Error(e.ExceptionObject.ToString());

+ 10 - 3
Unity/Assets/ThirdParty/protobuf-net/Meta/AttributeMap.cs

@@ -1,5 +1,6 @@
 #if !NO_RUNTIME
 #if !NO_RUNTIME
 using System;
 using System;
+using System.Linq;
 #if FEAT_IKVM
 #if FEAT_IKVM
 using Type = IKVM.Reflection.Type;
 using Type = IKVM.Reflection.Type;
 using IKVM.Reflection;
 using IKVM.Reflection;
@@ -38,7 +39,9 @@ namespace ProtoBuf.Meta
 #if WINRT || COREFX
 #if WINRT || COREFX
             Attribute[] all = System.Linq.Enumerable.ToArray(type.GetTypeInfo().GetCustomAttributes(inherit));
             Attribute[] all = System.Linq.Enumerable.ToArray(type.GetTypeInfo().GetCustomAttributes(inherit));
 #else
 #else
-            object[] all = type.GetCustomAttributes(inherit);
+            //object[] all = type.GetCustomAttributes(inherit);
+            // 过滤掉null的Attribute
+            object[] all = type.GetCustomAttributes(inherit).Where((x)=>x != null).ToArray();
 #endif
 #endif
             AttributeMap[] result = new AttributeMap[all.Length];
             AttributeMap[] result = new AttributeMap[all.Length];
             for(int i = 0 ; i < all.Length ; i++)
             for(int i = 0 ; i < all.Length ; i++)
@@ -64,7 +67,9 @@ namespace ProtoBuf.Meta
 #if WINRT || COREFX
 #if WINRT || COREFX
             Attribute[] all = System.Linq.Enumerable.ToArray(member.GetCustomAttributes(inherit));
             Attribute[] all = System.Linq.Enumerable.ToArray(member.GetCustomAttributes(inherit));
 #else
 #else
-            object[] all = member.GetCustomAttributes(inherit);
+            //object[] all = member.GetCustomAttributes(inherit);
+            // 过滤掉null的Attribute
+            object[] all = member.GetCustomAttributes(inherit).Where((x)=>x != null).ToArray();
 #endif
 #endif
             AttributeMap[] result = new AttributeMap[all.Length];
             AttributeMap[] result = new AttributeMap[all.Length];
             for(int i = 0 ; i < all.Length ; i++)
             for(int i = 0 ; i < all.Length ; i++)
@@ -92,7 +97,9 @@ namespace ProtoBuf.Meta
             Attribute[] all = System.Linq.Enumerable.ToArray(assembly.GetCustomAttributes());
             Attribute[] all = System.Linq.Enumerable.ToArray(assembly.GetCustomAttributes());
 #else
 #else
             const bool inherit = false;
             const bool inherit = false;
-            object[] all = assembly.GetCustomAttributes(inherit);
+            //object[] all = assembly.GetCustomAttributes(inherit);
+            // 过滤掉null的Attribute
+            object[] all = assembly.GetCustomAttributes(inherit).Where((x)=>x != null).ToArray();
 #endif
 #endif
             AttributeMap[] result = new AttributeMap[all.Length];
             AttributeMap[] result = new AttributeMap[all.Length];
             for(int i = 0 ; i < all.Length ; i++)
             for(int i = 0 ; i < all.Length ; i++)