Handle transient ConnectException globally in on-device HTTP tests#11057
Merged
jonathanpeppers merged 3 commits intomainfrom Mar 31, 2026
Merged
Handle transient ConnectException globally in on-device HTTP tests#11057jonathanpeppers merged 3 commits intomainfrom
jonathanpeppers merged 3 commits intomainfrom
Conversation
…Certificate test Agent-Logs-Url: https://github.com/dotnet/android/sessions/1a564216-e64a-43b1-8ce0-919d7bae7020 Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
jonathanpeppers
March 30, 2026 21:02
View session
tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidMessageHandlerTests.cs
Outdated
Show resolved
Hide resolved
…iled helper Agent-Logs-Url: https://github.com/dotnet/android/sessions/b5e86868-a3b2-488b-ab9c-1f1f9f832db4 Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot
AI
changed the title
Handle transient ConnectException in AndroidMessageHandlerSendsClientCertificate test
Handle transient ConnectException globally in on-device HTTP tests
Mar 30, 2026
… global fix Agent-Logs-Url: https://github.com/dotnet/android/sessions/1146d37f-4036-4a89-91ba-6ca76a3adb27 Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces flakiness in on-device HTTP tests by treating Java.Net.ConnectException as a transient network failure and ignoring affected test runs via the shared HttpClientHandlerTestBase helpers.
Changes:
- Extend
HttpClientHandlerTestBase.IgnoreIfConnectionFailed (HttpRequestException, ...)to ignoreJava.Net.ConnectExceptionas a transient connection failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes a flaky test failure in
AndroidMessageHandlerSendsClientCertificatecaused by transient network connectivity issues when connecting tocorefx-net-tls.azurewebsites.net.Problem
The test
Xamarin.Android.NetTests.AndroidMessageHandlerTests.AndroidMessageHandlerSendsClientCertificate(False)fails intermittently with:This is a transient network error unrelated to the functionality being tested.
Fix
Added
Java.Net.ConnectExceptionhandling to the globalIgnoreIfConnectionFailed(HttpRequestException)method inHttpClientHandlerTestBase, following the same pattern as the existingIOExceptioncheck added in commit 1047b55. This ensures all on-device HTTP tests that use the shared helper methods (RunIgnoringNetworkIssues,ConnectIgnoreFailure,IgnoreIfConnectionFailed) automatically benefit from the new check. No per-test changes are needed.