diff --git a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs index 54c19c048..b853f885d 100644 --- a/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs +++ b/Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; -using System.Xml; using Microsoft.Win32; namespace Flow.Launcher.Infrastructure.Exception @@ -63,7 +62,7 @@ namespace Flow.Launcher.Infrastructure.Exception sb.AppendLine($"* Command Line: {Environment.CommandLine}"); sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}"); sb.AppendLine($"* Flow Launcher version: {Constant.Version}"); - sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}"); + sb.AppendLine($"* OS Version: {GetWindowsBuildVersionFromRegistry()}"); sb.AppendLine($"* IntPtr Length: {IntPtr.Size}"); sb.AppendLine($"* x64: {Environment.Is64BitOperatingSystem}"); sb.AppendLine($"* Python Path: {Constant.PythonPath}"); @@ -173,5 +172,21 @@ namespace Flow.Launcher.Infrastructure.Exception } } + public static string GetWindowsBuildVersionFromRegistry() + { + try + { + using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\")) + { + var buildRevision = registryKey.GetValue("UBR").ToString(); + var currentBuild = registryKey.GetValue("CurrentBuild").ToString(); + return currentBuild + "." + buildRevision; + } + } + catch + { + return Environment.OSVersion.VersionString; + } + } } } diff --git a/Flow.Launcher/Helper/ErrorReporting.cs b/Flow.Launcher/Helper/ErrorReporting.cs index a7ce7444c..db5a11f74 100644 --- a/Flow.Launcher/Helper/ErrorReporting.cs +++ b/Flow.Launcher/Helper/ErrorReporting.cs @@ -3,8 +3,6 @@ using System.Windows.Threading; using NLog; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Exception; -using NLog.Fluent; -using Log = Flow.Launcher.Infrastructure.Logger.Log; namespace Flow.Launcher.Helper { @@ -31,11 +29,11 @@ namespace Flow.Launcher.Helper //prevent application exist, so the user can copy prompted error info e.Handled = true; } - + public static string RuntimeInfo() { var info = $"\nFlow Launcher version: {Constant.Version}" + - $"\nOS Version: {Environment.OSVersion.VersionString}" + + $"\nOS Version: {ExceptionFormatter.GetWindowsBuildVersionFromRegistry()}" + $"\nIntPtr Length: {IntPtr.Size}" + $"\nx64: {Environment.Is64BitOperatingSystem}"; return info;