Skip to content

Commit 2bba75b

Browse files
Print windows build number in log
1 parent c61d6f7 commit 2bba75b

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Globalization;
44
using System.Linq;
55
using System.Text;
6-
using System.Xml;
76
using Microsoft.Win32;
87

98
namespace Flow.Launcher.Infrastructure.Exception
@@ -63,7 +62,7 @@ private static string CreateExceptionReport(System.Exception ex)
6362
sb.AppendLine($"* Command Line: {Environment.CommandLine}");
6463
sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
6564
sb.AppendLine($"* Flow Launcher version: {Constant.Version}");
66-
sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}");
65+
sb.AppendLine($"* OS Version: {GetWindowsBuildVersionFromRegistry()}");
6766
sb.AppendLine($"* IntPtr Length: {IntPtr.Size}");
6867
sb.AppendLine($"* x64: {Environment.Is64BitOperatingSystem}");
6968
sb.AppendLine($"* Python Path: {Constant.PythonPath}");
@@ -173,5 +172,21 @@ private static List<string> GetFrameworkVersionFromRegistry()
173172
}
174173

175174
}
175+
public static string GetWindowsBuildVersionFromRegistry()
176+
{
177+
try
178+
{
179+
using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\"))
180+
{
181+
var buildRevision = registryKey.GetValue("UBR").ToString();
182+
var currentBuild = registryKey.GetValue("CurrentBuild").ToString();
183+
return currentBuild + "." + buildRevision;
184+
}
185+
}
186+
catch
187+
{
188+
return Environment.OSVersion.VersionString;
189+
}
190+
}
176191
}
177192
}

Flow.Launcher/Helper/ErrorReporting.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
using NLog;
44
using Flow.Launcher.Infrastructure;
55
using Flow.Launcher.Infrastructure.Exception;
6-
using NLog.Fluent;
7-
using Log = Flow.Launcher.Infrastructure.Logger.Log;
86

97
namespace Flow.Launcher.Helper
108
{
@@ -31,11 +29,11 @@ public static void DispatcherUnhandledException(object sender, DispatcherUnhandl
3129
//prevent application exist, so the user can copy prompted error info
3230
e.Handled = true;
3331
}
34-
32+
3533
public static string RuntimeInfo()
3634
{
3735
var info = $"\nFlow Launcher version: {Constant.Version}" +
38-
$"\nOS Version: {Environment.OSVersion.VersionString}" +
36+
$"\nOS Version: {ExceptionFormatter.GetWindowsBuildVersionFromRegistry()}" +
3937
$"\nIntPtr Length: {IntPtr.Size}" +
4038
$"\nx64: {Environment.Is64BitOperatingSystem}";
4139
return info;

0 commit comments

Comments
 (0)