Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/08/11 11:37:43 (13 years ago)
Author:
gkronber
Message:

#1429 Improved plugin loading procedure to prevent exceptions when loading blocked plugins.

File:
1 edited

Legend:

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

    r5628 r5629  
    508508          if (desc.PluginState != PluginState.Disabled) {
    509509            try {
     510              string assemblyName = (from assembly in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies()
     511                                     where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase)
     512                                     select assembly.FullName).Single();
    510513              // now load the assemblies into the execution context 
    511514              // 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);
     515              // even when the assemby was successfully loaded into the reflection only context before
     516              var asm = Assembly.Load(assemblyName);
    514517            }
    515518            catch (BadImageFormatException) {
     
    524527            catch (SecurityException) {
    525528              desc.Disable("File " + Path.GetFileName(assemblyLocation) + " can't be loaded because of security constraints.");
     529            }
     530            catch (NotSupportedException ex) {
     531              // disable the plugin
     532              desc.Disable("Problem while loading plugin assemblies:" + Environment.NewLine + "NotSupportedException: " + ex.Message);
    526533            }
    527534          }
Note: See TracChangeset for help on using the changeset viewer.