Don't instantiate generic type definitions (like Dictionary`2) with too few or too many
type arguments.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=46250
MonoImageSet *set;
CollectData data;
+ g_assert (mono_class_get_generic_container (container_class)->type_argc == inst->type_argc);
+
memset (&helper, 0, sizeof(helper)); // act like g_new0
helper.container_class = container_class;
helper.context.class_inst = inst;
return NULL;
}
+ guint gtd_type_argc = mono_class_get_generic_container (klass)->type_argc;
+ if (gtd_type_argc != type_argc) {
+ mono_loader_unlock ();
+ mono_error_set_argument (error, "types", "The generic type definition needs %d type arguments, but was instantiated with %d ", gtd_type_argc, type_argc);
+ return NULL;
+ }
+
+
if (klass->wastypebuilder)
is_dynamic = TRUE;