Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/13/08 18:58:34 (16 years ago)
Author:
gkronber
Message:

Stability improvement.
also makes debugging easier (related to #149). Should be merged into the trunk after testing.

  • added exception handling in PluginManager to graciously unload AppDomains when an uncaught exception is occurred
  • added exception handling in the starter-form to display an error message-box
File:
1 edited

Legend:

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

    r29 r241  
    103103      setup.PrivateBinPath = pluginDir;
    104104      AppDomain applicationDomain = AppDomain.CreateDomain(appInfo.Name + " AppDomain", null, setup);
    105 
    106       Runner remoteRunner = (Runner)applicationDomain.CreateInstanceAndUnwrap("HeuristicLab.PluginInfrastructure", "HeuristicLab.PluginInfrastructure.Runner");
    107       NotifyListeners(PluginManagerAction.Initializing, "All plugins");
    108       remoteRunner.LoadPlugins(remoteLoader.ActivePlugins);
    109       NotifyListeners(PluginManagerAction.Initialized, "All plugins");
    110       remoteRunner.Run(appInfo);
    111 
    112       AppDomain.Unload(applicationDomain);
     105      try {
     106        Runner remoteRunner = (Runner)applicationDomain.CreateInstanceAndUnwrap("HeuristicLab.PluginInfrastructure", "HeuristicLab.PluginInfrastructure.Runner");
     107        NotifyListeners(PluginManagerAction.Initializing, "All plugins");
     108        remoteRunner.LoadPlugins(remoteLoader.ActivePlugins);
     109        NotifyListeners(PluginManagerAction.Initialized, "All plugins");
     110        remoteRunner.Run(appInfo);
     111      } catch(Exception ex) {
     112        // can't handle exception here -> rethrow
     113        throw new ApplicationException("Exception in "+appInfo.Name, ex);
     114      } finally {
     115        // make sure domain is unloaded in all cases
     116        AppDomain.Unload(applicationDomain);
     117      }
    113118    }
    114119
Note: See TracChangeset for help on using the changeset viewer.