Skip to content

Remove Windows 7 support code from System.Net.Security#124555

Merged
rzikm merged 5 commits intomainfrom
copilot/remove-windows-7-support-code
Mar 6, 2026
Merged

Remove Windows 7 support code from System.Net.Security#124555
rzikm merged 5 commits intomainfrom
copilot/remove-windows-7-support-code

Conversation

Copy link
Contributor

Copilot AI commented Feb 18, 2026

Description

Windows 7 is no longer a supported OS. Remove Win7-specific code paths, dead branches, and outdated comments from System.Net.Security.

Product code

  • SslCertificateTrust.cs: Replace IsWindowsVersionAtLeast(6, 2) guard with IsWindows() — the version check only excluded Win7, which is no longer reachable. Remove unused System.Runtime.Versioning using.
  • SslAuthenticationOptions.cs: Remove comment about SSL2+TLS1.2 incompatibility on pre-Win10 (code stays, it's still correct).
  • ExtendedProtectionPolicy.cs: Update comment to clarify ExtendedProtection is supported on all Windows versions supported by current .NET version.
  • SslStreamPal.Windows.cs: Clarify legacy SCHANNEL_CRED comment — it's for older Windows versions, not specific to Win7.

Test code

  • TestConfiguration.cs: Remove dead !PlatformDetection.IsWindows10OrLater branch in null encryption detection.
  • SslStreamSystemDefaultsTest.cs: Simplify IsWindows && WindowsVersion >= 10 to IsWindows.
  • SslStreamCredentialCacheTest.cs: Update comment referencing Win8 behavioral change from Win7.

Note: The SCHANNEL_CRED / UseNewCryptoApi dual-path remains — it serves Win10 builds before 18836 (pre-TLS 1.3), not Win7.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

- SslCertificateTrust.cs: Replace IsWindowsVersionAtLeast(6, 2) with IsWindows()
- SslAuthenticationOptions.cs: Remove obsolete comment about SSL2 on pre-Win10
- ExtendedProtectionPolicy.cs: Update "Win7+" comment to "Windows"
- SslStreamPal.Windows.cs: Update legacy API comment to "older Windows 10"
- TestConfiguration.cs: Remove dead pre-Win10 null encryption branch
- SslStreamSystemDefaultsTest.cs: Simplify WindowsVersion >= 10 to IsWindows
- SslStreamCredentialCacheTest.cs: Update Win8 behavior comment

Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove unsupported Windows 7 code in System.Net.Security Remove Windows 7 support code from System.Net.Security Feb 18, 2026
Copilot AI requested a review from rzikm February 18, 2026 15:00
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@MihaZupan MihaZupan marked this pull request as ready for review March 4, 2026 15:50
Copilot AI review requested due to automatic review settings March 4, 2026 15:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes Windows 7–specific branches and updates related comments in System.Net.Security, simplifying runtime and test logic now that Win7 is out of support.

Changes:

  • Simplify Windows gating logic (e.g., remove Win7-era version checks) and delete now-unused using directives.
  • Update/clarify platform-specific comments around Schannel credential paths and ExtendedProtection support assumptions.
  • Simplify test platform gating logic for Windows-specific behaviors.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/libraries/System.Net.Security/src/System/Net/Security/SslCertificateTrust.cs Removes Win7 version guard for “send trust in handshake” capability (now Windows vs non-Windows).
src/libraries/System.Net.Security/src/System/Net/Security/SslAuthenticationOptions.cs Removes outdated Windows-version-specific comment in SSL2/TLS1.2 filtering logic.
src/libraries/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicy.cs Updates comment to reflect current supported Windows baselines.
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs Adjusts comment describing the legacy Schannel credential path.
src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs Removes dead Windows version branch for null-encryption detection; updates comment.
src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs Simplifies Windows condition gating a hash-algorithm assertion.
src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamCredentialCacheTest.cs Updates Windows behavior comment regarding trusted issuers list behavior.
Comments suppressed due to low confidence (1)

src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs:49

  • SupportsNullEncryption: this starts PowerShell with RedirectStandardError=true but never reads StandardError or checks ExitCode. If Get-TlsCipherSuite fails (e.g., cmdlet missing/blocked), StandardOutput will be empty and this will incorrectly return false (skipping null-encryption tests) instead of falling back to the "assume availability" path. Consider draining StandardError and/or treating non-zero exit code / any stderr output as an indeterminate failure and returning true (or explicitly detecting the cmdlet with Get-Command).
                    // Null encryption may be disabled in Azure images
                    using (Process p = Process.Start(new ProcessStartInfo("powershell", "-Command Get-TlsCipherSuite") { RedirectStandardOutput = true, RedirectStandardError = true }))
                    {
                        using StreamReader reader = p.StandardOutput;
                        return reader.ReadToEnd().Contains("WITH_NULL");
                    }

@rzikm
Copy link
Member

rzikm commented Mar 4, 2026

I am sure there is more code that could be removed/simplified, but it would require closer scrutiny to identify these parts. I might try to dig out more as a follow up if I have time.

…treamPal.Windows.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rzikm rzikm enabled auto-merge (squash) March 5, 2026 17:46
@rzikm rzikm disabled auto-merge March 5, 2026 18:00
@rzikm
Copy link
Member

rzikm commented Mar 5, 2026

@copilot The SslStreamPal.Unix.cs seems to have changes on all lines, can you revert any whitespace/crlf changes you did to that file?

- Revert whitespace/CRLF changes in SslStreamPal.Windows.cs
- Revert whitespace/CRLF changes in ExtendedProtectionPolicy.cs
- Apply @jkotas suggestion for SslStreamPal.Windows.cs comment
- Apply @jkotas suggestion for ExtendedProtectionPolicy.cs comment

Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 5, 2026

@copilot The SslStreamPal.Unix.cs seems to have changes on all lines, can you revert any whitespace/crlf changes you did to that file?

The CRLF issue was actually on SslStreamPal.Windows.cs and ExtendedProtectionPolicy.cs, not SslStreamPal.Unix.cs (which was never modified). Both files have been reverted to LF line endings and the content changes re-applied cleanly in e28b77f.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • linux.contoso.com
    • Triggering command: /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet exec --runtimeconfig /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Net.Security.Tests/Debug/net11.0-unix/System.Net.Security.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Net.Security.Tests/Debug/net11.0-unix/System.Net.Security.Tests.deps.json /home/REDACTED/work/runtime/runtime/artifacts/bin/System.Net.Security.Tests/Debug/net11.0-unix/Microsoft.DotNet.RemoteExecutor.dll System.Net.Security.Tests, Version=11.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 System.Net.Security.Tests.NegotiateAuthenticationKerberosTest&#43;&lt;&gt;c &lt;Loopback_Success&gt;b__2_0 /tmp/mgd3fajh.e2i (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of rzikm March 5, 2026 18:31
Copilot AI requested a review from rzikm March 5, 2026 18:31
@rzikm
Copy link
Member

rzikm commented Mar 6, 2026

/ba-g Test failures are unrelated

@rzikm rzikm merged commit 289f5cd into main Mar 6, 2026
85 of 89 checks passed
@rzikm rzikm deleted the copilot/remove-windows-7-support-code branch March 6, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants