Skip to content

Commit b23dd72

Browse files
authored
[release/6.0] Fix WinHttp StreamingTest backward compat version (#104838)
* Disable Bidirection tests on WS2022 * Add missing helper method * Update BidirectionStreamingTest.cs
1 parent 50f436d commit b23dd72

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public static partial class PlatformDetection
2424
public static bool IsWindows8x => IsWindows && GetWindowsVersion() == 6 && (GetWindowsMinorVersion() == 2 || GetWindowsMinorVersion() == 3);
2525
public static bool IsWindows8xOrLater => IsWindowsVersionOrLater(6, 2);
2626
public static bool IsWindows10OrLater => IsWindowsVersionOrLater(10, 0);
27+
public static bool IsWindowsServer2022 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 20348;
2728
public static bool IsWindowsNanoServer => IsWindows && (IsNotWindowsIoTCore && GetWindowsInstallationType().Equals("Nano Server", StringComparison.OrdinalIgnoreCase));
2829
public static bool IsWindowsServerCore => IsWindows && GetWindowsInstallationType().Equals("Server Core", StringComparison.OrdinalIgnoreCase);
2930
public static int WindowsVersion => IsWindows ? (int)GetWindowsVersion() : -1;
@@ -170,6 +171,7 @@ internal static Version GetWindowsVersionObject()
170171

171172
internal static uint GetWindowsVersion() => (uint)GetWindowsVersionObject().Major;
172173
internal static uint GetWindowsMinorVersion() => (uint)GetWindowsVersionObject().Minor;
174+
internal static uint GetWindowsBuildVersion() => (uint)GetWindowsVersionObject().Build;
173175

174176
internal static bool IsWindowsVersionOrLater(int major, int minor, int build = -1)
175177
{

src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/BidirectionStreamingTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public BidirectionStreamingTest(ITestOutputHelper output) : base(output)
2222

2323
// Build number suggested by the WinHttp team.
2424
// It can be reduced if bidirectional streaming is backported.
25-
public static bool OsSupportsWinHttpBidirectionalStreaming => Environment.OSVersion.Version >= new Version(10, 0, 22357, 0);
25+
public static bool OsSupportsWinHttpBidirectionalStreaming => Environment.OSVersion.Version >= new Version(10, 0, 22357, 0) || PlatformDetection.IsWindowsServer2022;
2626

27-
public static bool TestsEnabled => OsSupportsWinHttpBidirectionalStreaming && PlatformDetection.SupportsAlpn;
27+
public static bool TestsEnabled => OsSupportsWinHttpBidirectionalStreaming && PlatformDetection.SupportsAlpn && !PlatformDetection.IsWindowsServer2022;
2828

2929
public static bool TestsBackwardsCompatibilityEnabled => !OsSupportsWinHttpBidirectionalStreaming && PlatformDetection.SupportsAlpn;
3030

0 commit comments

Comments
 (0)