Skip to content

[src] Set HttpRequestError for NSUrlSessionHandler failures. Fixes #27554 - #27605

Open
rolfbjarne wants to merge 6 commits into
mainfrom
dev/rolf/http-request-errors
Open

rolfbjarne wants to merge 6 commits into
mainfrom
dev/rolf/http-request-errors

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 88ea2567482ed9ecb542f0344584f10c141d74c3

Dimension Assessment Rationale
Change confidence 8/10 ↑ Focused macOS tests cover native error mapping, rejected and missing certificates, and superseded client-certificate errors.
↑ The new regression cases fail when their corresponding fixes are removed.
↓ The new cases simulate native challenges; stale state followed by trust-callback rejection remains untested.
Diagnosis confidence 9/10 ↑ The issue's reported Unknown categories match exception construction that omitted HttpRequestError.
↑ Regression cases exercise the reported DNS and TLS classifications.
Evidence fit 9/10 ↑ The reported DNS and rejected-certificate failures map to the behaviors covered by the new macOS tests.
↓ The iOS repro from the issue was not run.

Summary

  • Map native DNS, connection, and TLS errors to the matching HttpRequestError categories while preserving the original native error.
  • Preserve SecureConnectionError for certificate rejection and missing-client-certificate failures.
  • Clear stale client-certificate challenge state when a response, redirect, or trust rejection supersedes it.

Fixes #27554

🤖 Pull request created by Copilot

rolfbjarne and others added 3 commits December 3, 2026 09:08
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner December 3, 2026 08:51
Copilot AI balanced review requested due to automatic review settings December 3, 2026 08:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Missing regression coverage for superseded client-certificate exceptions leaves terminal-failure reporting and redirect cleanup unverified.

1 open issue
What changed in this PR

Addresses #27554 by giving NSUrlSessionHandler failures meaningful HttpRequestError categories while preserving existing exception details.

Changes:

  • Classifies native DNS, connection, and TLS failures.
  • Clears stale client-certificate errors when superseded.
  • Adds error-mapping and certificate-failure assertions.
File Description
tests/​monotouch-test/​System.Net.Http/​NSUrlSessionHandlerTest.cs Adds native-error mapping and rejected-certificate tests.
tests/​monotouch-test/​System.Net.Http/​MessageHandlers.cs Verifies missing-client-certificate error classification.
src/​Foundation/​NSUrlSessionHandler.cs Maps failure categories and manages provisional certificate errors.

Review effort: Balanced

Comment thread src/Foundation/NSUrlSessionHandler.cs Resolved
@MauiBot

MauiBot commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

🔥 [PR Build #3858e61] Build failed (Build packages) 🔥

Build failed for the job 'Build packages' (with job status 'Failed')

Pipeline on Agent
Hash: 3858e6125dd43b747742abd923a560b5596c7aa6 [PR build]

@MauiBot

MauiBot commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

🔥 [PR Build #3858e61] Build failed (Detect API changes) 🔥

Build failed for the job 'Detect API changes' (with job status 'Failed')

Pipeline on Agent
Hash: 3858e6125dd43b747742abd923a560b5596c7aa6 [PR build]

@MauiBot

MauiBot commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

🔥 [PR Build #3858e61] Build failed (Build packages) 🔥

Build failed for the job 'Build packages' (with job status 'Failed')

Pipeline on Agent
Hash: 3858e6125dd43b747742abd923a560b5596c7aa6 [PR build]

@MauiBot

MauiBot commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

🔥 Unable to find the contents for the comment: D:\a\1\s\change-detection\results\gh-comment.md does not exist :fire

Pipeline on Agent
Hash: 3858e6125dd43b747742abd923a560b5596c7aa6 [PR build]

@MauiBot

MauiBot commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #3858e61] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

29 tests crashed, 0 tests failed, 0 tests passed.

Failures

❌ assembly-processing tests

🔥 Failed catastrophically on VSTS: test results - assembly-processing (no summary found).

Html Report (VSDrops) Download

❌ cecil tests

🔥 Failed catastrophically on VSTS: test results - cecil (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (iOS)

🔥 Failed catastrophically on VSTS: test results - dotnettests_ios (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (MacCatalyst)

🔥 Failed catastrophically on VSTS: test results - dotnettests_maccatalyst (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (macOS)

🔥 Failed catastrophically on VSTS: test results - dotnettests_macos (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (Multiple platforms)

🔥 Failed catastrophically on VSTS: test results - dotnettests_multiple (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (tvOS)

🔥 Failed catastrophically on VSTS: test results - dotnettests_tvos (no summary found).

Html Report (VSDrops) Download

❌ framework tests

🔥 Failed catastrophically on VSTS: test results - framework (no summary found).

Html Report (VSDrops) Download

❌ fsharp tests

🔥 Failed catastrophically on VSTS: test results - fsharp (no summary found).

Html Report (VSDrops) Download

❌ generator tests

🔥 Failed catastrophically on VSTS: test results - generator (no summary found).

Html Report (VSDrops) Download

❌ interdependent-binding-projects tests

🔥 Failed catastrophically on VSTS: test results - interdependent-binding-projects (no summary found).

Html Report (VSDrops) Download

❌ introspection tests

🔥 Failed catastrophically on VSTS: test results - introspection (no summary found).

Html Report (VSDrops) Download

❌ linker tests (iOS)

🔥 Failed catastrophically on VSTS: test results - linker_ios (no summary found).

Html Report (VSDrops) Download

❌ linker tests (MacCatalyst)

🔥 Failed catastrophically on VSTS: test results - linker_maccatalyst (no summary found).

Html Report (VSDrops) Download

❌ linker tests (macOS)

🔥 Failed catastrophically on VSTS: test results - linker_macos (no summary found).

Html Report (VSDrops) Download

❌ linker tests (tvOS)

🔥 Failed catastrophically on VSTS: test results - linker_tvos (no summary found).

Html Report (VSDrops) Download

❌ monotouch tests (iOS)

🔥 Failed catastrophically on VSTS: test results - monotouch_ios (no summary found).

Html Report (VSDrops) Download

❌ monotouch tests (MacCatalyst)

🔥 Failed catastrophically on VSTS: test results - monotouch_maccatalyst (no summary found).

Html Report (VSDrops) Download

❌ monotouch tests (macOS)

🔥 Failed catastrophically on VSTS: test results - monotouch_macos (no summary found).

Html Report (VSDrops) Download

❌ monotouch tests (tvOS)

🔥 Failed catastrophically on VSTS: test results - monotouch_tvos (no summary found).

Html Report (VSDrops) Download

❌ msbuild tests

🔥 Failed catastrophically on VSTS: test results - msbuild (no summary found).

Html Report (VSDrops) Download

❌ sharpie tests

🔥 Failed catastrophically on VSTS: test results - sharpie (no summary found).

Html Report (VSDrops) Download

❌ windows tests

🔥 Failed catastrophically on VSTS: test results - windows (no summary found).

Html Report (VSDrops) Download

❌ xcframework tests

🔥 Failed catastrophically on VSTS: test results - xcframework (no summary found).

Html Report (VSDrops) Download

❌ xtro tests

🔥 Failed catastrophically on VSTS: test results - xtro (no summary found).

Html Report (VSDrops) Download

❌ Tests on macOS Sonoma (14) tests

⚠️ Tests did not run because the Build macOS tests job failed.

Html Report (VSDrops) Download

❌ Tests on macOS Sequoia (15) tests

⚠️ Tests did not run because the Build macOS tests job failed.

Html Report (VSDrops) Download

❌ Tests on macOS Tahoe (26) tests

⚠️ Tests did not run because the Build macOS tests job failed.

Html Report (VSDrops) Download

❌ Tests on macOS Golden Gate (27) tests

⚠️ Tests did not run because the Build macOS tests job failed.

Html Report (VSDrops) Download

Successes

macOS tests

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 3858e6125dd43b747742abd923a560b5596c7aa6 [PR build]

rolfbjarne and others added 2 commits December 3, 2026 13:03
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Cover native connection errors after a missing client certificate and TLS errors after a redirect.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 3, 2026 12:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A sequential-challenge regression is missing, leaving unverified that trust rejection after saved client-certificate state produces SecureConnectionError with a TrustFailure inner exception rather than cancellation.

1 open issue
1 resolved since last review

Review effort: Balanced

// see as if the request was cancelled.
lock (inflight.Lock) {
inflight.Exception = new HttpRequestException ("An error occurred while sending the request.", new WebException ("Error: TrustFailure"));
inflight.IsClientCertificateException = false;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm holding off on another push to avoid a review/fix cycle. This is another test for an earlier review fix, so I need human input on whether to add it to this PR.

Note

Copilot-generated reply.

Auto-replied by the GitHub Copilot app

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Don't implement this, it seems unrelated to the purpose of this PR.

@MauiBot

MauiBot commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 2874fd58a1266b12b4e2f2c9c76cafcff675c9ba [PR build]

@MauiBot

MauiBot commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #2874fd5] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

2 tests crashed, 48 tests failed, 93 tests passed.

Failures

❌ monotouch tests (iOS)

11 tests failed, 0 tests passed.

Failed tests

  • monotouch-test/iOS - simulator/Debug: Failed
  • monotouch-test/iOS - simulator/Debug (dynamic registrar): Failed
  • monotouch-test/iOS - simulator/Debug (trimmable static registrar): Failed
  • monotouch-test/iOS - simulator/Release (link sdk): Failed
  • monotouch-test/iOS - simulator/Release (link all): Failed
  • monotouch-test/iOS - simulator/Release (all optimizations, link all): Failed
  • monotouch-test/iOS - simulator/Release (NativeAOT): Failed
  • monotouch-test/iOS - simulator/Release (compat inline Class.GetHandle): Failed
  • monotouch-test/iOS - simulator/Release (strict inline Class.GetHandle): Failed
  • monotouch-test/iOS - simulator/Release (compat inline dlfcn): Failed
  • monotouch-test/iOS - simulator/Release (strict inline dlfcn, link sdk): Failed

Html Report (VSDrops) Download

❌ monotouch tests (MacCatalyst)

11 tests failed, 0 tests passed.

Failed tests

  • monotouch-test/Mac Catalyst/Debug: Failed (Test run failed.
    Tests run: 4234 Passed: 4058 Inconclusive: 20 Failed: 1 Ignored: 175)
  • monotouch-test/Mac Catalyst/Debug (dynamic registrar): Failed (Test run failed.
    Tests run: 4237 Passed: 4060 Inconclusive: 20 Failed: 1 Ignored: 176)
  • monotouch-test/Mac Catalyst/Debug (trimmable static registrar): Failed (Test run failed.
    Tests run: 4234 Passed: 4058 Inconclusive: 20 Failed: 1 Ignored: 175)
  • monotouch-test/Mac Catalyst/Release (link sdk): Failed (Test run failed.
    Tests run: 4234 Passed: 4051 Inconclusive: 20 Failed: 1 Ignored: 182)
  • monotouch-test/Mac Catalyst/Release (link all): Failed (Test run failed.
    Tests run: 4234 Passed: 4050 Inconclusive: 20 Failed: 1 Ignored: 183)
  • monotouch-test/Mac Catalyst/Release (all optimizations, link all): Failed (Test run failed.
    Tests run: 4234 Passed: 4045 Inconclusive: 20 Failed: 1 Ignored: 188)
  • monotouch-test/Mac Catalyst/Release (NativeAOT): Failed (Test run failed.
    Tests run: 4234 Passed: 4041 Inconclusive: 20 Failed: 1 Ignored: 192)
  • monotouch-test/Mac Catalyst/Release (compat inline Class.GetHandle): Failed (Test run failed.
    Tests run: 4234 Passed: 4051 Inconclusive: 20 Failed: 1 Ignored: 182)
  • monotouch-test/Mac Catalyst/Release (strict inline Class.GetHandle): Failed (Test run failed.
    Tests run: 4234 Passed: 4052 Inconclusive: 20 Failed: 1 Ignored: 181)
  • monotouch-test/Mac Catalyst/Release (compat inline dlfcn): Failed (Test run failed.
    Tests run: 4234 Passed: 4051 Inconclusive: 20 Failed: 1 Ignored: 182)
  • monotouch-test/Mac Catalyst/Release (strict inline dlfcn, link sdk): Failed (Test run failed.
    Tests run: 4234 Passed: 4052 Inconclusive: 20 Failed: 1 Ignored: 181)

Html Report (VSDrops) Download

❌ monotouch tests (macOS)

11 tests failed, 0 tests passed.

Failed tests

  • monotouch-test/macOS/Debug: Failed (Test run failed.
    Tests run: 4207 Passed: 4059 Inconclusive: 14 Failed: 1 Ignored: 147)
  • monotouch-test/macOS/Debug (dynamic registrar): Failed (Test run failed.
    Tests run: 4210 Passed: 4065 Inconclusive: 14 Failed: 1 Ignored: 144)
  • monotouch-test/macOS/Debug (trimmable static registrar): Failed (Test run failed.
    Tests run: 4207 Passed: 4061 Inconclusive: 14 Failed: 1 Ignored: 145)
  • monotouch-test/macOS/Release (link sdk): Failed (Test run failed.
    Tests run: 4207 Passed: 4060 Inconclusive: 14 Failed: 1 Ignored: 146)
  • monotouch-test/macOS/Release (link all): Failed (Test run failed.
    Tests run: 4207 Passed: 4058 Inconclusive: 14 Failed: 1 Ignored: 148)
  • monotouch-test/macOS/Release (all optimizations, link all): Failed (Test run failed.
    Tests run: 4207 Passed: 4063 Inconclusive: 14 Failed: 1 Ignored: 143)
  • monotouch-test/macOS/Release (NativeAOT): Failed (Test run failed.
    Tests run: 4206 Passed: 4049 Inconclusive: 14 Failed: 1 Ignored: 156)
  • monotouch-test/macOS/Release (compat inline Class.GetHandle): Failed (Test run failed.
    Tests run: 4207 Passed: 4060 Inconclusive: 14 Failed: 1 Ignored: 146)
  • monotouch-test/macOS/Release (strict inline Class.GetHandle): Failed (Test run failed.
    Tests run: 4207 Passed: 4059 Inconclusive: 14 Failed: 1 Ignored: 147)
  • monotouch-test/macOS/Release (compat inline dlfcn): Failed (Test run failed.
    Tests run: 4207 Passed: 4060 Inconclusive: 14 Failed: 1 Ignored: 146)
  • monotouch-test/macOS/Release (strict inline dlfcn, link sdk): Failed (Test run failed.
    Tests run: 4207 Passed: 4060 Inconclusive: 14 Failed: 1 Ignored: 146)

Html Report (VSDrops) Download

❌ monotouch tests (tvOS)

11 tests failed, 0 tests passed.

Failed tests

  • monotouch-test/tvOS - simulator/Debug: Failed
  • monotouch-test/tvOS - simulator/Debug (dynamic registrar): Failed
  • monotouch-test/tvOS - simulator/Debug (trimmable static registrar): Failed
  • monotouch-test/tvOS - simulator/Release (link sdk): Failed
  • monotouch-test/tvOS - simulator/Release (link all): Failed
  • monotouch-test/tvOS - simulator/Release (all optimizations, link all): Failed
  • monotouch-test/tvOS - simulator/Release (NativeAOT): Failed
  • monotouch-test/tvOS - simulator/Release (compat inline Class.GetHandle): Failed
  • monotouch-test/tvOS - simulator/Release (strict inline Class.GetHandle): Failed
  • monotouch-test/tvOS - simulator/Release (compat inline dlfcn): Failed
  • monotouch-test/tvOS - simulator/Release (strict inline dlfcn, link sdk): Failed

Html Report (VSDrops) Download

❌ sharpie tests

🔥 Failed catastrophically on VSTS: test results - sharpie (no summary found).

Html Report (VSDrops) Download

❌ windows tests

🔥 Failed catastrophically on VSTS: test results - windows (no summary found).

Html Report (VSDrops) Download

❌ Tests on macOS Sonoma (14) tests

1 tests failed, 4 tests passed.

Failed tests

  • macOS/osx-x64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError
  • MacCatalyst/maccatalyst-x64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError

Html Report (VSDrops) Download

❌ Tests on macOS Sequoia (15) tests

1 tests failed, 4 tests passed.

Failed tests

  • macOS/osx-x64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError
  • macOS/osx-arm64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError
  • MacCatalyst/maccatalyst-x64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError
  • MacCatalyst/maccatalyst-arm64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError

Html Report (VSDrops) Download

❌ Tests on macOS Tahoe (26) tests

1 tests failed, 4 tests passed.

Failed tests

  • macOS/osx-x64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError
  • macOS/osx-arm64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError
  • MacCatalyst/maccatalyst-x64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError
  • MacCatalyst/maccatalyst-arm64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError

Html Report (VSDrops) Download

❌ Tests on macOS Golden Gate (27) tests

1 tests failed, 4 tests passed.

Failed tests

  • macOS/osx-arm64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError
  • MacCatalyst/maccatalyst-arm64 monotouch-test: Failed (exit code 1)
    • [FAIL] TestNSUrlSessionHandlerDetectMissingClientCertificate : HttpRequestError

Html Report (VSDrops) Download

Successes

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 1 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 12 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 12 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 12 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 2874fd58a1266b12b4e2f2c9c76cafcff675c9ba [PR build]

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NSUrlSessionHandler doesn't set HttpRequestException.HttpRequestError

3 participants