if (iface_exprs != null) {
foreach (TypeExpr iface in iface_exprs) {
+ // Prevents a crash, the interface might not have been resolved: 442144
+ if (iface == null)
+ continue;
+
var iface_type = iface.Type;
if (!spec.AddInterface (iface_type))
if (iface_exprs != null) {
foreach (TypeExpr iface in iface_exprs) {
+ // the interface might not have been resolved, prevents a crash, see #442144
+ if (iface == null)
+ continue;
var ptc = iface.Type.MemberDefinition as Interface;
if (ptc != null && ptc.CheckRecursiveDefinition (this) != null)
return iface.Type;
ct.CheckConstraints (this);
var baseContainer = base_type.Type.MemberDefinition as ClassOrStruct;
- if (baseContainer != null)
+ if (baseContainer != null) {
baseContainer.Define ();
+
+ //
+ // It can trigger define of this type (for generic types only)
+ //
+ if (HasMembersDefined)
+ return true;
+ }
}
if (type_params != null) {
if (fields == null)
return true;
- if (requires_delayed_unmanagedtype_check)
- return true;
-
if (has_unmanaged_check_done)
return is_unmanaged;
- has_unmanaged_check_done = true;
+ if (requires_delayed_unmanagedtype_check)
+ return true;
+
+ requires_delayed_unmanagedtype_check = true;
foreach (FieldBase f in fields) {
if (f.IsStatic)
// struct S { S* s; }
TypeSpec mt = f.MemberType;
if (mt == null) {
- has_unmanaged_check_done = false;
- requires_delayed_unmanagedtype_check = true;
return true;
}
- // TODO: Remove when pointer types are under mcs control
while (mt.IsPointer)
mt = TypeManager.GetElementType (mt);
if (mt.MemberDefinition == this) {
for (var p = Parent; p != null; p = p.Parent) {
- if (p.Kind == MemberKind.Class)
+ if (p.Kind == MemberKind.Class) {
+ has_unmanaged_check_done = true;
return false;
+ }
}
continue;
}
if (TypeManager.IsUnmanagedType (mt))
continue;
+ has_unmanaged_check_done = true;
return false;
}
+ has_unmanaged_check_done = true;
is_unmanaged = true;
return true;
}