Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8536


Ignore:
Timestamp:
08/29/12 10:36:35 (12 years ago)
Author:
mkommend
Message:

#1923: Reverse merged r8531 (changes in application managers) as this introduced errors in the type discovery.

Location:
trunk/sources/HeuristicLab.PluginInfrastructure/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs

    r8531 r8536  
    7575      foreach (Type t in GetTypes(type)) {
    7676        object instance = null;
    77         try { instance = Activator.CreateInstance(t); }
    78         catch { }
     77        try { instance = Activator.CreateInstance(t); } catch { }
    7978        if (instance != null) instances.Add(instance);
    8079      }
     
    138137               where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
    139138               select t;
    140       }
    141       catch (TypeLoadException) {
     139      } catch (TypeLoadException) {
    142140        return Enumerable.Empty<Type>();
    143       }
    144       catch (ReflectionTypeLoadException) {
     141      } catch (ReflectionTypeLoadException) {
    145142        return Enumerable.Empty<Type>();
    146143      }
     
    166163        foreach (var genericArgument in typeGenericArguments) {
    167164          if (otherGenericArguments[i].IsGenericParameter) {
    168             //check class contraint on generic type parameter
    169             if (otherGenericArguments[i].GenericParameterAttributes.HasFlag(GenericParameterAttributes.ReferenceTypeConstraint))
    170               if (!genericArgument.IsClass) return false;
    171 
    172             //check default constructor constraint on generic type parameter
    173             if (otherGenericArguments[i].GenericParameterAttributes.HasFlag(GenericParameterAttributes.DefaultConstructorConstraint))
    174               if (!genericArgument.IsValueType && genericArgument.GetConstructor(Type.EmptyTypes) == null) return false;
    175 
    176165            foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints())
    177166              if (!constraint.IsAssignableFrom(genericArgument)) return false;
     
    184173          if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
    185174            return true;
    186         }
    187         catch (Exception) { }
     175        } catch (Exception) { }
    188176      }
    189177      return false;
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/SandboxApplicationManager.cs

    r8531 r8536  
    293293        foreach (var genericArgument in typeGenericArguments) {
    294294          if (otherGenericArguments[i].IsGenericParameter) {
    295             //check class contraint on generic type parameter
    296             if (otherGenericArguments[i].GenericParameterAttributes.HasFlag(GenericParameterAttributes.ReferenceTypeConstraint))
    297               if (!genericArgument.IsClass) return false;
    298 
    299             //check default constructor constraint on generic type parameter
    300             if (otherGenericArguments[i].GenericParameterAttributes.HasFlag(GenericParameterAttributes.DefaultConstructorConstraint))
    301               if (!genericArgument.IsValueType && genericArgument.GetConstructor(Type.EmptyTypes) == null) return false;
    302 
    303295            foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints())
    304296              if (!constraint.IsAssignableFrom(genericArgument)) return false;
Note: See TracChangeset for help on using the changeset viewer.