Opened 5 years ago

Closed 5 years ago

#1887 closed defect (done)

Show more descriptive error message for exceptions while loading plugins

Reported by: gkronber Owned by: abeham
Priority: high Milestone: HeuristicLab 3.3.7
Component: PluginInfrastructure Version: 3.3.7
Keywords: Cc:


Attachments (1) (6.6 MB) - added by gkronber 5 years ago.

Change History (11)

comment:1 Changed 5 years ago by gkronber

  • Status changed from new to accepted

comment:2 Changed 5 years ago by gkronber

r8178: throwing a more informative exception when loading a plugin fails because it's assemblies are not loaded.

comment:3 Changed 5 years ago by gkronber

The reported exception can only occur when all assemblies of the plugin can be loaded into the reflection-only and in the execution context in an earlier step but later in LoadPlugins the assemblies are not found in the list of assemblies loaded in the current AppDomain. Since we are comparing assemblies by location maybe this can happen if one of our assemblies is also residing in the GAC and loaded from there instead? This has to be analyzed in more detail...

More detailed information: in line 550 of PluginValidator.cs

List<Assembly> assemblies = 
  new List<Assembly>(AppDomain.CurrentDomain.GetAssemblies());
foreach (var desc in pluginDescriptions) {
  if (desc.PluginState == PluginState.Enabled) {
    // cannot use ApplicationManager to retrieve types because 
    // it is not yet instantiated
    foreach (string assemblyLocation in desc.AssemblyLocations) {
      var asm = (from assembly in assemblies
                 where string.Equals(Path.GetFullPath(assembly.Location), 
                 select assembly)
     if (asm == null) 
       throw new InvalidPluginException("Could not assembly " + assemblyLocation + 
                                        " for plugin " + desc.Name);

Changed 5 years ago by gkronber

comment:4 Changed 5 years ago by gkronber

Reproduced the problem by installing Mono.Cecil.dll to the GAC.

comment:5 Changed 5 years ago by gkronber

r8193: fixed a problem in plugin loading which occurs if one of the assemblies shipped with HeuristicLab is already installed in the GAC of the machine.

comment:6 Changed 5 years ago by gkronber

  • Owner changed from gkronber to abeham
  • Status changed from accepted to reviewing

comment:7 Changed 5 years ago by abeham

Okay, I looked at the change r8193. So instead of relying on a path reference to identify the assembly you're now comparing them by their full name.

The exception message in line 559 in PluginValidator.cs reads "Could not assembly " + assemblyName + " for plugin " + desc.Name. It says assembly when you probably meant "find" or "locate".

comment:8 Changed 5 years ago by gkronber

r8200: fixed exception message

comment:9 Changed 5 years ago by abeham

  • Status changed from reviewing to readytorelease


comment:10 Changed 5 years ago by gkronber

  • Resolution set to done
  • Status changed from readytorelease to closed
  • Version changed from 3.3.6 to 3.3.7
Note: See TracTickets for help on using tickets.