private void OnNewVersion(object sender, VersionFoundEventArgs e) { try { if (_runningDomain != null) { _runningDomain.Stop(); _runningDomain.PanicRequested -= OnClientDomainPanic; _runningDomain.AppDomainException -= OnClientDomainException; } } catch (Exception exception) { } try { var id = Path.GetFileName(e.VersionPath); var domain = new HostedAppDomain(typeof(T)); domain.Configure(id, e.VersionPath); domain.Start(); domain.AppDomainException += OnClientDomainException; domain.PanicRequested += OnClientDomainPanic; _runningDomain = domain; _config["RunningVersion"] = id; } catch (Exception exception) { } }
private void OnNewVersion(object sender, VersionFoundEventArgs e) { try { if (_runningDomain != null) { _runningDomain.PanicRequested -= OnClientDomainPanic; _runningDomain.AppDomainException -= OnClientDomainException; _runningDomain.Stop(); } } catch (Exception exception) { //TODO: What to do? Application in incosistent state _logger.Error("Failed to shut down the old version", exception); } try { var id = Path.GetFileName(e.VersionPath); var domain = new HostedAppDomain(typeof(T)); domain.Configure(id, e.VersionPath); domain.Start(); domain.AppDomainException += OnClientDomainException; domain.PanicRequested += OnClientDomainPanic; _runningDomain = domain; _config["RunningVersion"] = id; } catch (Exception exception) { //TODO: What to do? Application in incosistent state _logger.Error("Fail to launch the new version", exception); } }