static void
ensure_generic_class_runtime_vtable (MonoClass *klass)
{
	MonoClass *gklass = klass->generic_class->container_class;
	int i;

	if (klass->wastypebuilder)
		return;

	ensure_runtime_vtable (gklass);

	klass->method.count = gklass->method.count;
	klass->methods = mono_image_alloc (klass->image, sizeof (MonoMethod*) * (klass->method.count + 1));

	for (i = 0; i < klass->method.count; i++) {
		klass->methods [i] = mono_class_inflate_generic_method_full (
			gklass->methods [i], klass, mono_class_get_context (klass));
	}

	klass->interface_count = gklass->interface_count;
	klass->interfaces = mono_image_alloc (klass->image, sizeof (MonoClass*) * klass->interface_count);
	for (i = 0; i < klass->interface_count; ++i) {
		MonoType *iface_type = mono_class_inflate_generic_type (&gklass->interfaces [i]->byval_arg, mono_class_get_context (klass));
		klass->interfaces [i] = mono_class_from_mono_type (iface_type);
		mono_metadata_free_type (iface_type);

		ensure_runtime_vtable (klass->interfaces [i]);
	}
	klass->interfaces_inited = 1;

	/*We can only finish with this klass once it's parent has as well*/
	if (gklass->wastypebuilder)
		klass->wastypebuilder = TRUE;
	return;
static void
ensure_generic_class_runtime_vtable (MonoClass *klass)
{
	MonoClass *gklass = klass->generic_class->container_class;
	int i;

	if (klass->wastypebuilder)
		return;

	ensure_runtime_vtable (gklass);

	klass->method.count = gklass->method.count;
	klass->methods = mono_image_alloc (klass->image, sizeof (MonoMethod*) * (klass->method.count + 1));

	for (i = 0; i < klass->method.count; i++) {
		klass->methods [i] = mono_class_inflate_generic_method_full (
			gklass->methods [i], klass, mono_class_get_context (klass));
	}

	klass->interface_count = gklass->interface_count;
	klass->interfaces = mono_image_alloc (klass->image, sizeof (MonoClass*) * klass->interface_count);
	for (i = 0; i < klass->interface_count; ++i) {
		MonoType *iface_type = mono_class_inflate_generic_type (&gklass->interfaces [i]->byval_arg, mono_class_get_context (klass));
		klass->interfaces [i] = mono_class_from_mono_type (iface_type);
		mono_metadata_free_type (iface_type);

		ensure_runtime_vtable (klass->interfaces [i]);
	}
	klass->interfaces_inited = 1;

	 
	if (gklass->wastypebuilder)
		klass->wastypebuilder = TRUE;
	return;