Changeset 2726


Ignore:
Timestamp:
01/30/10 05:00:47 (10 years ago)
Author:
swagner
Message:

Corrected handling of generic content types (#857)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm/3.2/MainFormManager.cs

    r2724 r2726  
    8383        viewTypes[i] = TransformGenericTypeDefinition(viewTypes[i], contentType);
    8484      }
    85       return viewTypes;
     85      return viewTypes.Where(t => t != null);
    8686    }
    8787
     
    150150        return viewType;
    151151
    152       Type contentTypeBaseType = contentType;
     152      Type contentTypeBaseType = null;
    153153      foreach (Type type in ContentAttribute.GetViewableTypes(viewType)) {
     154        contentTypeBaseType = contentType;
    154155        while (contentTypeBaseType != null && (!contentTypeBaseType.IsGenericType ||
    155156              type.GetGenericTypeDefinition() != contentTypeBaseType.GetGenericTypeDefinition()))
     
    160161          IEnumerable<Type> implementedInterfaces = contentType.GetInterfaces().Where(t => t.IsGenericType);
    161162          foreach (Type implementedInterface in implementedInterfaces) {
    162             if (implementedInterface.CheckGenericTypes(viewType))
     163            if (implementedInterface.CheckGenericTypes(type))
    163164              contentTypeBaseType = implementedInterface;
    164165          }
    165166        }
     167        if (contentTypeBaseType != null) break;
    166168      }
    167169
Note: See TracChangeset for help on using the changeset viewer.