镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[release/11.0] Backport test-only fixes for HTTP certificate and EncryptedXml tests - #137306

Merged
lewing merged 4 commits into
dotnet:release/11.0from
lewing:lewing-backport-http-cert-encryptedxml-tests
Nov 11, 2026
Merged

lewing merged 4 commits into
dotnet:release/11.0from
lewing:lewing-backport-http-cert-encryptedxml-tests

Conversation

@lewing

@lewing lewing commented Nov 10, 2026

Copy link
Copy Markdown
Member

Fixes Issue N/A (CI test failures on release/11.0, see Description)

main PR #135273, #135618, #135975, #136119

Description

Backports four test-only fixes from main. They are cherry-picked with -x in this order and all applied cleanly:

  1. Isolate HttpClient certificate validation tests from TLS resumption #135273 (a4802e5): Isolate HttpClient certificate validation tests from TLS resumption
  2. Replace badssl HTTP certificate tests with loopback servers #135618 (f521600): Replace badssl HTTP certificate tests with loopback servers
  3. Fix Android HTTP certificate validation tests #135975 (39ab468): Fix Android HTTP certificate validation tests
  4. Guard EncryptedXml_DecryptDocument_MaxCount_Default with RemoteExecutor.IsSupported #136119 (677ab53): Guard EncryptedXml_DecryptDocument_MaxCount_Default with RemoteExecutor.IsSupported

These tests fail in rolling (non-PR) CI on release/11.0 but don't fail on main. The failures come from Kusto engsrvprod/engineeringdata AzureDevOpsTests, non-PR CI over the last 21 days:

All 12 changed files are under Common/tests or */tests. Product code is unchanged.

Customer Impact

None. Only tests change. Taking this removes recurring false failures from release/11.0 CI.

Regression

No. The failures are caused by external endpoints and platform test-infra limits, not product regressions.

Testing

  • The cherry-picks applied with no conflicts. The resulting tree matches a sequential git merge-tree simulation onto origin/release/11.0.
  • I checked that git diff --name-only origin/release/11.0 contains only test files.
  • I didn't build or run anything locally (local disk space is limited). CI on this PR is the validation.

Risk

Very low. Only test code changes, and it already ships on main.

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.

Note

This PR description was generated with GitHub Copilot.

rzikm and others added 4 commits November 10, 2026 16:59
…otnet#135273)

<!-- -->

Resumed initial TLS handshakes now skip certificate revalidation and
user validation callbacks by default (dotnet#133174). HttpClient tests that
require those callbacks, certificate-policy checks, or certificate
rejection can therefore fail or bypass their assertions after another
connection populates the session cache. This follows the SslStream
test-isolation approach in dotnet#135083.

Add an optional `allowTlsResume = true` option to the existing handler
helpers and request full handshakes only in validation-dependent tests.
Preserve parameterless helper behavior, version-specific certificate
defaults, and unrelated tests. The option reaches
`SocketsHttpHandler.SslOptions.AllowTlsResume`; WinHTTP and native
mobile handlers retain their native behavior because they do not expose
this setting. Custom-policy tests set the option in their replacement
SSL options rather than losing it when replacing the bag.

Add coverage for default/true/false helper forwarding and repeated
callback execution across fresh connections. The repeated test follows
the existing .NET Framework loopback certificate-ownership convention.
No product code or public API changes.

### Evidence and limitations

With resumption enabled, the repeated self-signed test reproduced a
failure on the second fresh connection: expected callback count 2,
actual 1. With resumption disabled, all three callbacks execute. Sampled
CI stacks also show callback-not-called and
missing-certificate-rejection assertions. Separate badssl handshake
resets and connection timeouts are not established resumption failures
and are not claimed fixed here.

HTTP/3 callback coverage passes, but QUIC does not currently consume
`AllowTlsResume`; this is not a claimed QUIC-resumption fix. Validation
was on Windows x64 only, with Release CoreCLR and Debug libraries. Other
platforms and enterprise tests were not run.

### Validation

All commands ran from a short `subst` path (`W:\`).

- `.\build.cmd clr+libs -rc release`: passed, zero warnings/errors.

Each project below was built and tested with `.\.dotnet\dotnet.exe build
<project> /t:Test /p:RuntimeConfiguration=Release`:

| Project | Result |
|---|---|
|
`src\libraries\System.Net.Http\tests\FunctionalTests\System.Net.Http.Functional.Tests.csproj`
| Passed: 5,435 passed, 48 skipped, zero failures |
|
`src\libraries\System.Net.Http\tests\UnitTests\System.Net.Http.Unit.Tests.csproj`
| Passed: 2,677 passed, four skipped, zero failures |
|
`src\libraries\System.Net.Http.WinHttpHandler\tests\FunctionalTests\System.Net.Http.WinHttpHandler.Functional.Tests.csproj`
| Passed: net11.0-windows 1,710 passed / 41 skipped; net481 640 passed /
28 skipped; zero failures |
|
`src\libraries\System.Net.Http.WinHttpHandler\tests\UnitTests\System.Net.Http.WinHttpHandler.Unit.Tests.csproj`
| Passed: 173 passed, zero failures |

External certificate and SSL-protocol coverage:

```powershell
.\.dotnet\dotnet.exe build src\libraries\System.Net.Http\tests\FunctionalTests\System.Net.Http.Functional.Tests.csproj /t:Test /p:RuntimeConfiguration=Release /p:Outerloop=true "/p:XUnitOptions=-class System.Net.Http.Functional.Tests.SocketsHttpHandler_HttpClientHandler_ServerCertificates_Test -class System.Net.Http.Functional.Tests.SocketsHttpHandler_HttpClientHandler_SslProtocols_Test"
```

Passed: 53 passed, zero skipped/failures.

Negative control, with `allowTlsResume` temporarily enabled in the
repeated self-signed test:

```powershell
.\.dotnet\dotnet.exe build src\libraries\System.Net.Http\tests\FunctionalTests\System.Net.Http.Functional.Tests.csproj /t:Test /p:RuntimeConfiguration=Release "/p:XUnitOptions=-method *UseCallback_SelfSignedCertificate_ExpectedPolicyErrors"
```

Expected failure: one passed, one failed due to the skipped second
callback. Restored `allowTlsResume: false` before the final successful
full-suite and outerloop runs.

`git diff --check`: passed.

> [!NOTE]
> This PR description and code changes were generated with assistance
from GitHub Copilot.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit a4802e5)
…35618)

<!-- -->

HTTP certificate validation tests currently depend on public badssl.com
endpoints, making their results sensitive to external availability and
certificate configuration. Replace the applicable cases with loopback
servers and certificates generated by the existing test helpers.

- Cover expired, self-signed, and wrong-host certificates with default
validation, custom callbacks, and validation-disabled handlers. These
cases now run in the inner loop.
- Use scoped `X509ChainPolicy` custom trust to isolate
SocketsHttpHandler validation errors, and the existing local
PKI/revocation responder to exercise both revocation settings without
installing trusted roots.
- Dispose provisional TLS streams when loopback authentication fails,
with a regression test for deterministic cleanup.

The two external, no-callback WinHTTP revocation tests are intentionally
retained. WinHttpHandler cannot use scoped custom trust, and
callback-enabled replacements would test managed chain validation rather
than native WinHTTP revocation enforcement.

## Validation

Windows x64, using the `X:` subst path:

- `build.cmd clr+libs -rc release`: passed.
- Focused System.Net.Http certificate classes: 27 passed, none skipped.
- Focused WinHTTP HTTP/1.1 and HTTP/2 certificate classes on
`net11.0-windows`: 44 passed, none skipped.
- Shared WinHTTP certificate tests on `net481`: 11 passed, none skipped.
- Fourteen certificate/cleanup scenarios passed three consecutive
reruns.
- The cleanup regression failed before the helper fix and passed
afterward.

Linux, macOS, mobile, and the retained external WinHTTP revocation cases
were not run. No product code or public API changes.

> [!NOTE]
> This pull request description was generated by GitHub Copilot.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
Copilot-Session: 63463cf1-4bfe-42e3-ad96-49f35e245dd1
(cherry picked from commit f521600)
…or.IsSupported (dotnet#136119)

`EncryptedXml_DecryptDocument_MaxCount_Default` (added in dotnet#135741) calls
`RemoteExecutor.Invoke` from a plain `[Fact]`, so it throws
`PlatformNotSupportedException` where RemoteExecutor isn't supported,
e.g. the `runtime-coreclr crossgen2` outerloop R2R library runs ([build
1639697](https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1639697)).
This changes it to `[ConditionalFact(typeof(RemoteExecutor),
nameof(RemoteExecutor.IsSupported))]`, matching its sibling
`_AppContext` tests.

> [!NOTE]
> This PR was generated with the assistance of GitHub Copilot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 677ab53)
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@lewing lewing added the Servicing-approved Approved for servicing release label Nov 11, 2026
@lewing

lewing commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

/ba-g failures are known and tracked

@lewing
lewing merged commit 4a2ad96 into dotnet:release/11.0 Nov 11, 2026
101 of 104 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net.Http Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants