Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Aug 11, 2023
1 parent eaa5ca3 commit ae98344
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Grpc.Net.Client/Internal/NtDll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#endregion

#if NET462_OR_GREATER
#if !NET5_0_OR_GREATER

using System.Runtime.InteropServices;

Expand Down
10 changes: 5 additions & 5 deletions src/Grpc.Net.Client/Internal/OperatingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ internal sealed class OperatingSystem : IOperatingSystem

private OperatingSystem()
{
IsBrowser = RuntimeInformation.IsOSPlatform(OSPlatform.Create("browser"));
#if NET5_0_OR_GREATER
IsAndroid = System.OperatingSystem.IsAndroid();
IsWindows = System.OperatingSystem.IsWindows();
IsBrowser = System.OperatingSystem.IsBrowser();
OSVersion = Environment.OSVersion.Version;
#else
IsAndroid = false;
#endif
IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
#if NET462_OR_GREATER
IsBrowser = RuntimeInformation.IsOSPlatform(OSPlatform.Create("browser"));

// Older versions of .NET report an OSVersion.Version based on Windows compatibility settings.
// For example, if an app running on Windows 11 is configured to be "compatible" with Windows 10
// then the version returned is always Windows 10.
//
// Get correct Windows version directly from Windows by calling RtlGetVersion.
// https://www.pinvoke.net/default.aspx/ntdll/RtlGetVersion.html
OSVersion = IsWindows ? NtDll.DetectWindowsVersion() : Environment.OSVersion.Version;
#else
OSVersion = Environment.OSVersion.Version;
#endif
}
}

0 comments on commit ae98344

Please sign in to comment.