[netcore] Don't load types in aot-compiler.c that don't exist in corefx
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 25 Oct 2019 18:27:34 +0000 (20:27 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 28 Oct 2019 12:57:17 +0000 (13:57 +0100)
Fixes https://github.com/mono/mono/issues/16026

Commit migrated from https://github.com/mono/mono/commit/fb7b075e4930751421a5feb0b9ac095d832df228

src/mono/mono/mini/aot-compiler.c

index e28670c..ac31793 100644 (file)
@@ -5266,6 +5266,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
                else
                        name_prefix = g_strdup_printf ("%s.%s", klass_name_space, klass_name);
 
+#ifndef ENABLE_NETCORE
                /* Add the T[]/InternalEnumerator class */
                if (!strcmp (klass_name, "IEnumerable`1") || !strcmp (klass_name, "IEnumerator`1")) {
                        ERROR_DECL (error);
@@ -5281,6 +5282,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth,
                        mono_error_assert_ok (error); /* FIXME don't swallow the error */
                        add_generic_class (acfg, nclass, FALSE, "ICollection<T>");
                }
+#endif
 
                iter = NULL;
                while ((method = mono_class_get_methods (array_class, &iter))) {
@@ -5647,6 +5649,7 @@ add_generic_instances (MonoAotCompile *acfg)
                        enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "EnumEqualityComparer`1");
                        add_instances_of (acfg, enum_comparer, insts, ninsts, FALSE);
 
+#ifndef ENABLE_NETCORE
                        ninsts = 0;
                        insts [ninsts ++] = int16_type;
                        enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "ShortEnumEqualityComparer`1");
@@ -5662,6 +5665,7 @@ add_generic_instances (MonoAotCompile *acfg)
                        insts [ninsts ++] = int64_type;
                        insts [ninsts ++] = uint64_type;
                        add_instances_of (acfg, enum_comparer, insts, ninsts, FALSE);
+#endif
                }
 
                /* Add instances of the array generic interfaces for primitive types */