- Timestamp:
- 07/03/12 16:46:35 (12 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators
- Property svn:mergeinfo changed
/trunk/sources merged: 8084,8088-8090,8092-8100,8102-8113,8115,8117-8132,8134-8146,8148-8156,8158-8160,8163-8170,8173-8176,8178-8190,8192-8205
- Property svn:mergeinfo changed
-
branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginDescription.cs
r7259 r8206 139 139 } 140 140 141 /// <summary> 142 /// Gets and sets the list of assembly names for this plugin. Assembly names are only available after the plugin has been loaded. 143 /// </summary> 144 private List<string> assemblyNames; 145 public IEnumerable<string> AssemblyNames { 146 get { return assemblyNames; } 147 set { this.assemblyNames = new List<string>(value); } 148 } 149 141 150 internal PluginDescription() { 142 151 pluginState = PluginState.Undefined; -
branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs
r7259 r8206 506 506 foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(pluginDescriptions 507 507 .Where(x => x.PluginState != PluginState.Disabled))) { 508 // store the assembly names so that we can later retrieve the assemblies loaded in the appdomain by name 509 var assemblyNames = new List<string>(); 508 510 foreach (string assemblyLocation in desc.AssemblyLocations) { 509 511 if (desc.PluginState != PluginState.Disabled) { … … 515 517 // this can still lead to an exception 516 518 // even when the assemby was successfully loaded into the reflection only context before 517 var asm = Assembly.Load(assemblyName); 519 // when loading the assembly using it's assemblyName it can be loaded from a different location than before (e.g. the GAC) 520 Assembly.Load(assemblyName); 521 assemblyNames.Add(assemblyName); 518 522 } 519 523 catch (BadImageFormatException) { … … 535 539 } 536 540 } 541 desc.AssemblyNames = assemblyNames; 537 542 } 538 543 } … … 547 552 if (desc.PluginState == PluginState.Enabled) { 548 553 // cannot use ApplicationManager to retrieve types because it is not yet instantiated 549 foreach (string assembly Location in desc.AssemblyLocations) {554 foreach (string assemblyName in desc.AssemblyNames) { 550 555 var asm = (from assembly in assemblies 551 where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase)556 where assembly.FullName == assemblyName 552 557 select assembly) 553 .Single ();554 558 .SingleOrDefault(); 559 if (asm == null) throw new InvalidPluginException("Could not load assembly " + assemblyName + " for plugin " + desc.Name); 555 560 foreach (Type pluginType in asm.GetTypes()) { 556 561 if (typeof(IPlugin).IsAssignableFrom(pluginType) && !pluginType.IsAbstract && !pluginType.IsInterface && !pluginType.HasElementType) {
Note: See TracChangeset
for help on using the changeset viewer.