Changeset 5628 for trunk/sources/HeuristicLab.PluginInfrastructure
- Timestamp:
- 03/08/11 10:56:06 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs
r5445 r5628 117 117 CheckPluginDependencyCycles(pluginDescriptions); 118 118 119 // recursively check if all necessary plugins are available and not disabled 120 // disable plugins with missing or disabled dependencies 119 // 1st time recursively check if all necessary plugins are available and not disabled 120 // disable plugins with missing or disabled dependencies 121 // to prevent that plugins with missing dependencies are loaded into the execution context 122 // in the next step 121 123 CheckPluginDependencies(pluginDescriptions); 122 124 … … 124 126 // disables plugins that are not loaded correctly 125 127 CheckExecutionContextLoad(pluginDescriptions); 128 129 // 2nd time recursively check if all necessary plugins have been loaded successfully and not disabled 130 // disable plugins with for which dependencies could not be loaded successfully 131 CheckPluginDependencies(pluginDescriptions); 126 132 127 133 // mark all plugins as enabled that were not disabled in CheckPluginFiles, CheckPluginAssemblies, … … 500 506 .Where(x => x.PluginState != PluginState.Disabled))) { 501 507 foreach (string assemblyLocation in desc.AssemblyLocations) { 502 try { 503 // now load the assemblies into the execution context 504 // this can still lead to an exception 505 // even when the assembly was successfully loaded into the reflection only context before 506 var asm = Assembly.LoadFrom(assemblyLocation); 507 } 508 catch (BadImageFormatException) { 509 desc.Disable(Path.GetFileName(assemblyLocation) + " is not a valid assembly."); 510 } 511 catch (FileLoadException) { 512 desc.Disable("Can't load file " + Path.GetFileName(assemblyLocation)); 513 } 514 catch (FileNotFoundException) { 515 desc.Disable("File " + Path.GetFileName(assemblyLocation) + " is missing."); 516 } 517 catch (SecurityException) { 518 desc.Disable("File " + Path.GetFileName(assemblyLocation) + " can't be loaded because of security constraints."); 508 if (desc.PluginState != PluginState.Disabled) { 509 try { 510 // now load the assemblies into the execution context 511 // this can still lead to an exception 512 // even when the assembly was successfully loaded into the reflection only context before 513 var asm = Assembly.LoadFrom(assemblyLocation); 514 } 515 catch (BadImageFormatException) { 516 desc.Disable(Path.GetFileName(assemblyLocation) + " is not a valid assembly."); 517 } 518 catch (FileLoadException) { 519 desc.Disable("Can't load file " + Path.GetFileName(assemblyLocation)); 520 } 521 catch (FileNotFoundException) { 522 desc.Disable("File " + Path.GetFileName(assemblyLocation) + " is missing."); 523 } 524 catch (SecurityException) { 525 desc.Disable("File " + Path.GetFileName(assemblyLocation) + " can't be loaded because of security constraints."); 526 } 519 527 } 520 528 } … … 533 541 foreach (string assemblyLocation in desc.AssemblyLocations) { 534 542 var asm = (from assembly in assemblies 535 where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase)536 select assembly)543 where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase) 544 select assembly) 537 545 .Single(); 538 546
Note: See TracChangeset
for help on using the changeset viewer.