From 6ddab61e92430abdfce2c46ba8ba5f464bdce92b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 17:48:47 +0000 Subject: [PATCH 1/4] Initial plan From cb64eb6e5128bce0ea0b6ecdca3b7434ac284d7a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 18:13:16 +0000 Subject: [PATCH 2/4] Ignore transient SSL errors in on-device HTTP client handler tests Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com> --- .../AndroidClientHandlerTests.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs b/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs index 5dda01affb9..3b4215252e1 100644 --- a/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs +++ b/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs @@ -123,7 +123,10 @@ protected bool IgnoreIfConnectionFailed (AggregateException aex, out bool connec if (IgnoreIfConnectionFailed (aex.InnerException as WebException, out connectionFailed)) return true; - return IgnoreIfSocketException (aex, out connectionFailed); + if (IgnoreIfSocketException (aex, out connectionFailed)) + return true; + + return IgnoreIfSSLFailure (aex, out connectionFailed); } bool IgnoreIfConnectionFailed (HttpRequestException hrex, out bool connectionFailed) @@ -168,6 +171,28 @@ bool IgnoreIfSocketException (Exception ex, out bool connectionFailed) } return false; } + + bool IgnoreIfSSLFailure (Exception ex, out bool connectionFailed) + { + connectionFailed = false; + // Check the exception and all inner exceptions for transient SSL errors + var current = ex; + while (current != null) { + if (current is System.IO.IOException ioEx) { + var message = ioEx.Message ?? ""; + if (message.Contains ("SSL", StringComparison.OrdinalIgnoreCase) && + (message.Contains ("BAD_DECRYPT", StringComparison.OrdinalIgnoreCase) || + message.Contains ("DECRYPTION_FAILED", StringComparison.OrdinalIgnoreCase) || + message.Contains ("protocol error", StringComparison.OrdinalIgnoreCase))) { + connectionFailed = true; + Assert.Ignore ($"Ignoring transient SSL error: {ioEx}"); + return true; + } + } + current = current.InnerException; + } + return false; + } } [Category ("AndroidClientHandler")] From 2e5b11e0bc905f0b93b64f4e7d974e14748f1856 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 18:46:58 +0000 Subject: [PATCH 3/4] Simplify: ignore all IOException instead of checking for specific SSL keywords Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com> --- .../AndroidClientHandlerTests.cs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs b/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs index 3b4215252e1..8e45b78c4c2 100644 --- a/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs +++ b/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs @@ -126,7 +126,7 @@ protected bool IgnoreIfConnectionFailed (AggregateException aex, out bool connec if (IgnoreIfSocketException (aex, out connectionFailed)) return true; - return IgnoreIfSSLFailure (aex, out connectionFailed); + return IgnoreIfIOException (aex, out connectionFailed); } bool IgnoreIfConnectionFailed (HttpRequestException hrex, out bool connectionFailed) @@ -172,22 +172,15 @@ bool IgnoreIfSocketException (Exception ex, out bool connectionFailed) return false; } - bool IgnoreIfSSLFailure (Exception ex, out bool connectionFailed) + bool IgnoreIfIOException (Exception ex, out bool connectionFailed) { connectionFailed = false; - // Check the exception and all inner exceptions for transient SSL errors var current = ex; while (current != null) { if (current is System.IO.IOException ioEx) { - var message = ioEx.Message ?? ""; - if (message.Contains ("SSL", StringComparison.OrdinalIgnoreCase) && - (message.Contains ("BAD_DECRYPT", StringComparison.OrdinalIgnoreCase) || - message.Contains ("DECRYPTION_FAILED", StringComparison.OrdinalIgnoreCase) || - message.Contains ("protocol error", StringComparison.OrdinalIgnoreCase))) { - connectionFailed = true; - Assert.Ignore ($"Ignoring transient SSL error: {ioEx}"); - return true; - } + connectionFailed = true; + Assert.Ignore ($"Ignoring transient IO error: {ioEx}"); + return true; } current = current.InnerException; } From 6146a05f95ec2434f8b5571ac7ac8a953c52ff7f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 21:20:00 +0000 Subject: [PATCH 4/4] Scope IOException check to HttpRequestException inner exceptions Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com> --- .../AndroidClientHandlerTests.cs | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs b/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs index 8e45b78c4c2..bde3ee5b154 100644 --- a/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs +++ b/tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs @@ -123,15 +123,25 @@ protected bool IgnoreIfConnectionFailed (AggregateException aex, out bool connec if (IgnoreIfConnectionFailed (aex.InnerException as WebException, out connectionFailed)) return true; - if (IgnoreIfSocketException (aex, out connectionFailed)) - return true; - - return IgnoreIfIOException (aex, out connectionFailed); + return IgnoreIfSocketException (aex, out connectionFailed); } bool IgnoreIfConnectionFailed (HttpRequestException hrex, out bool connectionFailed) { - return IgnoreIfConnectionFailed (hrex?.InnerException as WebException, out connectionFailed); + connectionFailed = false; + if (hrex == null) + return false; + + if (IgnoreIfConnectionFailed (hrex.InnerException as WebException, out connectionFailed)) + return true; + + if (hrex.InnerException is System.IO.IOException ioEx) { + connectionFailed = true; + Assert.Ignore ($"Ignoring transient IO error: {ioEx}"); + return true; + } + + return false; } bool IgnoreIfConnectionFailed (WebException wex, out bool connectionFailed) @@ -172,20 +182,6 @@ bool IgnoreIfSocketException (Exception ex, out bool connectionFailed) return false; } - bool IgnoreIfIOException (Exception ex, out bool connectionFailed) - { - connectionFailed = false; - var current = ex; - while (current != null) { - if (current is System.IO.IOException ioEx) { - connectionFailed = true; - Assert.Ignore ($"Ignoring transient IO error: {ioEx}"); - return true; - } - current = current.InnerException; - } - return false; - } } [Category ("AndroidClientHandler")]