From 41ebb3e2d7e656519ca9af0f5e6fdc670aae2cde Mon Sep 17 00:00:00 2001 From: Christian Soltenborn Date: Sat, 4 Aug 2018 09:04:35 +0200 Subject: [PATCH] catching exceptions occuring during check for last version and showing release notes --- .../GoogleTestExtensionOptionsPage.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/GoogleTestAdapter/VsPackage.GTA/GoogleTestExtensionOptionsPage.cs b/GoogleTestAdapter/VsPackage.GTA/GoogleTestExtensionOptionsPage.cs index cb7b98435..e4bcfd866 100644 --- a/GoogleTestAdapter/VsPackage.GTA/GoogleTestExtensionOptionsPage.cs +++ b/GoogleTestAdapter/VsPackage.GTA/GoogleTestExtensionOptionsPage.cs @@ -5,6 +5,7 @@ using System.IO; using System.Threading; using GoogleTestAdapter.VsPackage.GTA.ReleaseNotes; +using GoogleTestAdapter.VsPackage.Helpers; namespace GoogleTestAdapter.VsPackage { @@ -20,6 +21,27 @@ private void DisplayReleaseNotesIfNecessary() } private void DisplayReleaseNotesIfNecessaryProc() + { + try + { + TryDisplayReleaseNotesIfNecessary(); + } + catch (Exception e) + { + string msg = $"Exception while trying to update last version and show release notes:{Environment.NewLine}{e}"; + try + { + new ActivityLogLogger(this, () => true).LogError(msg); + } + catch (Exception) + { + // well... + Console.Error.WriteLine(msg); + } + } + } + + private void TryDisplayReleaseNotesIfNecessary() { var versionProvider = new VersionProvider(this); @@ -31,7 +53,8 @@ private void DisplayReleaseNotesIfNecessaryProc() if ((_generalOptions.ShowReleaseNotes || History.ForceShowReleaseNotes(formerlyInstalledVersion)) && (formerlyInstalledVersion == null || formerlyInstalledVersion < currentVersion)) { - var creator = new ReleaseNotesCreator(formerlyInstalledVersion, currentVersion, Donations.IsPreDonationsVersion(formerlyInstalledVersion)); + var creator = new ReleaseNotesCreator(formerlyInstalledVersion, currentVersion, + Donations.IsPreDonationsVersion(formerlyInstalledVersion)); DisplayReleaseNotes(creator.CreateHtml()); } }