Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/24/12 14:04:43 (12 years ago)
Author:
abeham
Message:

#1774:

  • improved performance of type discovery by moving compatibility check further up the chain (deep cloneable unit test time reduced from 32s to 18s)
File:
1 edited

Legend:

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

    r7502 r7520  
    119119      try {
    120120        runnablePlugin.Run();
    121       }
    122       finally {
     121      } finally {
    123122        // unload plugins in reverse order
    124123        foreach (var plugin in loadedPlugins.Reverse<IPlugin>()) {
     
    150149      foreach (Type t in GetTypes(typeof(T), plugin, onlyInstantiable: true, includeGenericTypeDefinitions: false)) {
    151150        T instance = null;
    152         try { instance = (T)Activator.CreateInstance(t); }
    153         catch { }
     151        try { instance = (T)Activator.CreateInstance(t); } catch { }
    154152        if (instance != null) instances.Add(instance);
    155153      }
     
    166164      foreach (Type t in GetTypes(typeof(T), asm, onlyInstantiable: true, includeGenericTypeDefinitions: false)) {
    167165        T instance = null;
    168         try { instance = (T)Activator.CreateInstance(t); }
    169         catch { }
     166        try { instance = (T)Activator.CreateInstance(t); } catch { }
    170167        if (instance != null) instances.Add(instance);
    171168      }
     
    191188      foreach (Type t in GetTypes(type, onlyInstantiable: true, includeGenericTypeDefinitions: false)) {
    192189        object instance = null;
    193         try { instance = Activator.CreateInstance(t); }
    194         catch { }
     190        try { instance = Activator.CreateInstance(t); } catch { }
    195191        if (instance != null) instances.Add(instance);
    196192      }
     
    262258    private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable, bool includeGenericTypeDefinitions) {
    263259      var buildTypes = from t in assembly.GetTypes()
     260                       where CheckTypeCompatibility(type, t)
    264261                       where !IsNonDiscoverableType(t)
    265262                       where onlyInstantiable == false ||
    266263                             (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
    267                        where CheckTypeCompatibility(type, t)
    268264                       select BuildType(t, type);
    269265
     
    303299          if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
    304300            return true;
    305         }
    306         catch (Exception) { }
     301        } catch (Exception) { }
    307302      }
    308303      return false;
Note: See TracChangeset for help on using the changeset viewer.