public static bool StopPluginWithTimeout(PluginInfo info) { // guarantee that the plugin will stop even if it behaves badly Timer timer = new Timer(); timer.Interval = PluginStopTimeout; timer.Elapsed += delegate { StopTimeout(info); }; timer.Start(); try { info.controller.Stop(); return true; } catch (Exception ex) { Log.Warning(ex); return false; } finally { info.domain = null; } }
private static void StopTimeout(PluginInfo info) { Log.Debug("Timeout on domain " + info.domain.FriendlyName); AppDomain.Unload(info.domain); }