Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7586 for trunk/sources


Ignore:
Timestamp:
03/08/12 11:19:37 (13 years ago)
Author:
mkommend
Message:

#1792: Readded check if assembly location is null or string.Emtpy in type discovery.

File:
1 edited

Legend:

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

    r7520 r7586  
    119119      try {
    120120        runnablePlugin.Run();
    121       } finally {
     121      }
     122      finally {
    122123        // unload plugins in reverse order
    123124        foreach (var plugin in loadedPlugins.Reverse<IPlugin>()) {
     
    149150      foreach (Type t in GetTypes(typeof(T), plugin, onlyInstantiable: true, includeGenericTypeDefinitions: false)) {
    150151        T instance = null;
    151         try { instance = (T)Activator.CreateInstance(t); } catch { }
     152        try { instance = (T)Activator.CreateInstance(t); }
     153        catch { }
    152154        if (instance != null) instances.Add(instance);
    153155      }
     
    164166      foreach (Type t in GetTypes(typeof(T), asm, onlyInstantiable: true, includeGenericTypeDefinitions: false)) {
    165167        T instance = null;
    166         try { instance = (T)Activator.CreateInstance(t); } catch { }
     168        try { instance = (T)Activator.CreateInstance(t); }
     169        catch { }
    167170        if (instance != null) instances.Add(instance);
    168171      }
     
    188191      foreach (Type t in GetTypes(type, onlyInstantiable: true, includeGenericTypeDefinitions: false)) {
    189192        object instance = null;
    190         try { instance = Activator.CreateInstance(t); } catch { }
     193        try { instance = Activator.CreateInstance(t); }
     194        catch { }
    191195        if (instance != null) instances.Add(instance);
    192196      }
     
    231235      PluginDescription pluginDesc = (PluginDescription)pluginDescription;
    232236      return from asm in AppDomain.CurrentDomain.GetAssemblies()
    233              where !asm.IsDynamic
     237             where !asm.IsDynamic && !string.IsNullOrEmpty(asm.Location)
    234238             where pluginDesc.AssemblyLocations.Any(location => location.Equals(Path.GetFullPath(asm.Location), StringComparison.CurrentCultureIgnoreCase))
    235239             from t in GetTypes(type, asm, onlyInstantiable, includeGenericTypeDefinitions)
     
    299303          if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
    300304            return true;
    301         } catch (Exception) { }
     305        }
     306        catch (Exception) { }
    302307      }
    303308      return false;
Note: See TracChangeset for help on using the changeset viewer.