* Type.cs (GetTypeCodeImpl): If the type is a TypeBuilder
call into specific code.
* TypeBuilder.cs (GetTypeCodeInternal): New method that
handles enums correctly.
This change is required because calling into the runtime
with incomplete TypeBuilders cause the runtime to crash.
return res;
}
+ internal TypeCode GetTypeCodeInternal () {
+ if (parent == pmodule.assemblyb.corlib_enum_type) {
+ for (int i = 0; i < num_fields; ++i) {
+ FieldBuilder f = fields [i];
+ if (!f.IsStatic)
+ return Type.GetTypeCode (f.FieldType);
+ }
+ throw new InvalidOperationException ("Enum basetype field not defined");
+ } else {
+ return Type.GetTypeCodeInternal (this);
+ }
+ }
+
+
void _TypeBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
throw new NotImplementedException ();
Type type = this;
if (type is MonoType)
return GetTypeCodeInternal (type);
+ if (type is TypeBuilder)
+ return ((TypeBuilder)type).GetTypeCodeInternal ();
type = type.UnderlyingSystemType;