Changeset 2785


Ignore:
Timestamp:
02/12/10 13:03:50 (11 years ago)
Author:
gkronber
Message:

Fixed bug related to dynamically emitted assembly in plugin infrastructure. #870 (ApplicationManager.GetTypes throws exception when dynamic methods assemblies are loaded (e.g. by ProgrammableOperator))

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/ApplicationManager.cs

    r2748 r2785  
    235235      PluginDescription pluginDesc = (PluginDescription)pluginDescription;
    236236      return from asm in AppDomain.CurrentDomain.GetAssemblies()
    237              where !string.IsNullOrEmpty(asm.Location) // ignore dynamically generated assemblies
     237             where !IsDynamicAssembly(asm)
    238238             where pluginDesc.AssemblyLocations.Any(location => location.Equals(Path.GetFullPath(asm.Location), StringComparison.CurrentCultureIgnoreCase))
    239239             from t in GetTypes(type, asm, onlyInstantiable)
    240240             select t;
     241    }
     242
     243    private static bool IsDynamicAssembly(Assembly asm) {
     244      return (asm is System.Reflection.Emit.AssemblyBuilder) || string.IsNullOrEmpty(asm.Location);
    241245    }
    242246
Note: See TracChangeset for help on using the changeset viewer.