We may get called to create the parent of a dynamic generic instance; in this
[mono.git] / mono / metadata / reflection.c
index 8028261732b916b8c290131df142644da07138e6..91061a8a32f2a03794637fde8786e4d289ccac07 100644 (file)
@@ -6972,11 +6972,19 @@ do_mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_a
                tb = (MonoReflectionTypeBuilder *) type;
 
                icount = tb->interfaces ? mono_array_length (tb->interfaces) : 0;
+               ginst->is_dynamic = TRUE;
+       } else if (!strcmp (((MonoObject *) type)->vtable->klass->name, "MonoGenericInst")) {
+               MonoReflectionGenericInst *rgi = (MonoReflectionGenericInst *) type;
+               MonoReflectionType *rgt = rgi->generic_type;
+
+               g_assert (!strcmp (((MonoObject *) rgt)->vtable->klass->name, "TypeBuilder"));
+               tb = (MonoReflectionTypeBuilder *) rgt;
+
+               icount = tb->interfaces ? mono_array_length (tb->interfaces) : 0;
+               ginst->is_dynamic = TRUE;
        } else
                icount = klass->interface_count;
 
-       ginst->is_dynamic = tb != NULL;
-
        ginst->ifaces = g_new0 (MonoType *, icount);
        ginst->count_ifaces = icount;