Skip to content

Commit 7ca1197

Browse files
committed
Wrap Application start logging in try block. Closes #4556
1 parent 44f173a commit 7ca1197

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Rubberduck.Core/App.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,26 @@ public void LogRubberduckStart()
230230
{
231231
var version = _version.CurrentVersion;
232232
GlobalDiagnosticsContext.Set("RubberduckVersion", version.ToString());
233+
233234
var headers = new List<string>
234235
{
235236
$"\r\n\tRubberduck version {version} loading:",
236-
$"\tOperating System: {Environment.OSVersion.VersionString} {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}",
237-
$"\tHost Product: {Application.ProductName} {(Environment.Is64BitProcess ? "x64" : "x86")}",
238-
$"\tHost Version: {Application.ProductVersion}",
239-
$"\tHost Executable: {Path.GetFileName(Application.ExecutablePath).ToUpper()}", // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
237+
$"\tOperating System: {Environment.OSVersion.VersionString} {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}"
240238
};
239+
try
240+
{
241+
headers.AddRange(new []
242+
{
243+
$"\tHost Product: {Application.ProductName} {(Environment.Is64BitProcess ? "x64" : "x86")}",
244+
$"\tHost Version: {Application.ProductVersion}",
245+
$"\tHost Executable: {Path.GetFileName(Application.ExecutablePath).ToUpper()}", // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
246+
});
247+
}
248+
catch
249+
{
250+
headers.Add("\tHost could not be determined.");
251+
}
252+
241253
LogLevelHelper.SetDebugInfo(string.Join(Environment.NewLine, headers));
242254
}
243255

0 commit comments

Comments
 (0)