public void Stop() { try { var shutdownEvent = Shutdown; if (shutdownEvent != null) { shutdownEvent(this, EventArgs.Empty); } } catch (Exception ex) { ExceptionManager.RegisterException(ex); } try { OnStop(); } catch (Exception ex) { ExceptionManager.RegisterException(ex); } InitializationManager.TeardownAll(); _configuration.Save(); GC.Collect(); _shouldStop = true; }