Global Assert.Inconclusive() for transient network errors in tests#10941
Draft
Global Assert.Inconclusive() for transient network errors in tests#10941
Conversation
- Create HandleTransientNetworkErrorAttribute (NUnit IWrapSetUpTearDown) that catches transient network/SSL exceptions during any test execution and converts them to Assert.Inconclusive() results - Extract shared TransientNetworkErrorDetector with detection logic for HTTP status codes, SocketException, and IOException (SSL failures) - Update DownloadedCache.IsTransientError to use shared detector - Apply [assembly: HandleTransientNetworkError] in Xamarin.Android.Build.Tests and MSBuildDeviceIntegration test projects Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
jonathanpeppers
March 13, 2026 21:58
View session
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.
Tests like
Desugarfail hard on transient SSL/network errors (HttpRequestException→IOException: Received an unexpected EOF or 0 bytes from the transport stream). The existingDownloadedCache.IsTransientErroronly matched HTTP status codes andSocketException, missingIOException(SSL failures). More broadly, there was no global mechanism — any network call outsideDownloadedCachewould also fail hard.Changes
HandleTransientNetworkErrorAttribute— NUnitIWrapSetUpTearDownthat wraps entire test execution (setup/test/teardown) and converts transient network exceptions toAssert.Inconclusive()TransientNetworkErrorDetector— shared detection logic covering HTTP 408/502/503/504,SocketException,IOException(SSL), andAggregateExceptionflatteningDownloadedCache.IsTransientError— now delegates to the shared detector instead of duplicating logicXamarin.Android.Build.TestsandMSBuildDeviceIntegrationUsage
Applied globally via assembly attribute — no per-test code needed:
Can also be applied per-class or per-method if needed: