Author: kumpera
Date: 2007-07-12 17:13:39 -0400 (Thu, 12 Jul 2007)
New Revision: 81905
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/class.c
Log:
2007-07-12 Rodrigo Kumpera <[EMAIL PROTECTED]>
* class.c (mono_bounded_array_class_get): method fails if used with
an incomplete TypeBuilder enum (no basetype field), fixed it by
avoiding calculating the size for such array as it cannot be
instantiated.
Fix bug #82015
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-07-12 21:13:25 UTC (rev 81904)
+++ trunk/mono/mono/metadata/ChangeLog 2007-07-12 21:13:39 UTC (rev 81905)
@@ -1,3 +1,10 @@
+2007-07-12 Rodrigo Kumpera <[EMAIL PROTECTED]>
+
+ * class.c (mono_bounded_array_class_get): method fails if used with
+ an incomplete TypeBuilder enum (no basetype field), fixed it by
+ avoiding calculating the size for such array as it cannot be
instantiated.
+ Fix bug #82015
+
2007-07-12 Raja R Harinath <[EMAIL PROTECTED]>
* class-internals.h (_MonoGenericInst::is_reference): Remove bogus
Modified: trunk/mono/mono/metadata/class.c
===================================================================
--- trunk/mono/mono/metadata/class.c 2007-07-12 21:13:25 UTC (rev 81904)
+++ trunk/mono/mono/metadata/class.c 2007-07-12 21:13:39 UTC (rev 81905)
@@ -3524,7 +3524,17 @@
(eclass->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK);
class->parent = parent;
class->instance_size = mono_class_instance_size (class->parent);
- class->sizes.element_size = mono_class_array_element_size (eclass);
+
+ if (eclass->enumtype && !eclass->enum_basetype) {
+ if (!eclass->reflection_info || eclass->wastypebuilder) {
+ g_warning ("Only incomplete TypeBuilder objects are
allowed to be an enum without base_type");
+ g_assert (eclass->reflection_info &&
!eclass->wastypebuilder);
+ }
+ /* element_size -1 is ok as this is not an instantitable type*/
+ class->sizes.element_size = -1;
+ } else
+ class->sizes.element_size = mono_class_array_element_size
(eclass);
+
mono_class_setup_supertypes (class);
if (mono_defaults.generic_ilist_class) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches