- Timestamp:
- 05/13/08 18:58:34 (17 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/PluginManager.cs
r29 r241 103 103 setup.PrivateBinPath = pluginDir; 104 104 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 } 113 118 } 114 119 -
trunk/sources/HeuristicLab/MainForm.cs
r209 r241 94 94 PluginManager.Manager.Action += new PluginManagerActionEventHandler(splashScreen.Manager_Action); 95 95 Thread t = new Thread(delegate() { 96 PluginManager.Manager.Run(app); 96 try { 97 PluginManager.Manager.Run(app); 98 } catch(Exception ex) { 99 ShowErrorMessageBox(ex); 100 } 97 101 }); 98 102 t.SetApartmentState(ApartmentState.STA); // needed for the AdvancedOptimizationFrontent … … 122 126 } 123 127 128 public void ShowErrorMessageBox(Exception ex) { 129 MessageBox.Show(BuildErrorMessage(ex), 130 "Error - " + ex.GetType().Name, 131 MessageBoxButtons.OK, 132 MessageBoxIcon.Error); 133 } 134 private string BuildErrorMessage(Exception ex) { 135 StringBuilder sb = new StringBuilder(); 136 sb.Append("Sorry, but something went wrong!\n\n" + ex.Message + "\n\n" + ex.StackTrace); 137 138 while(ex.InnerException != null) { 139 ex = ex.InnerException; 140 sb.Append("\n\n-----\n\n" + ex.Message + "\n\n" + ex.StackTrace); 141 } 142 return sb.ToString(); 143 } 124 144 } 125 145 }
Note: See TracChangeset
for help on using the changeset viewer.