Skip to content

Commit b74ea00

Browse files
Use OSVersion.Version.Build to reduce registry access
1 parent d1f4f88 commit b74ea00

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Flow.Launcher.Infrastructure/Exception/ExceptionFormatter.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,9 @@ public static string GetWindowsFullVersionFromRegistry()
177177
{
178178
try
179179
{
180-
using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\"))
181-
{
182-
var buildRevision = GetWindowsRevisionFromRegistry();
183-
var currentBuild = registryKey.GetValue("CurrentBuild").ToString();
184-
return currentBuild + "." + buildRevision;
185-
}
180+
var buildRevision = GetWindowsRevisionFromRegistry();
181+
var currentBuild = Environment.OSVersion.Version.Build;
182+
return currentBuild.ToString() + "." + buildRevision;
186183
}
187184
catch
188185
{

0 commit comments

Comments
 (0)