From 30cf152733b0449bbf93e28a84081e968e3c8eb8 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 5 May 2026 08:25:52 -0500 Subject: [PATCH 1/2] Mark ProxyTest.QuoteInvalidQuoteUrlsShouldWork as Inconclusive on network failure Catch WebException for ConnectFailure, NameResolutionFailure, and Timeout and call Assert.Inconclusive() instead of failing. This matches the pattern used in SslTest and other network-dependent tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../System.Net/ProxyTest.cs | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/ProxyTest.cs b/tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/ProxyTest.cs index a46f56f70f0..50853a3a601 100644 --- a/tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/ProxyTest.cs +++ b/tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/ProxyTest.cs @@ -13,20 +13,27 @@ public class ProxyTest { [Test] public void QuoteInvalidQuoteUrlsShouldWork () { - string url = "http://www.msftconnecttest.com/connecttest.txt?query&foo|bar"; - var request = (HttpWebRequest) WebRequest.Create (url); - request.Method = "GET"; - var response = (HttpWebResponse) request.GetResponse (); - int len = 0; - using (var _r = new StreamReader (response.GetResponseStream ())) { - char[] buf = new char [4096]; - int n; - while ((n = _r.Read (buf, 0, buf.Length)) > 0) { - /* ignore; we just want to make sure we can read */ - len += n; + try { + string url = "http://www.msftconnecttest.com/connecttest.txt?query&foo|bar"; + var request = (HttpWebRequest) WebRequest.Create (url); + request.Method = "GET"; + var response = (HttpWebResponse) request.GetResponse (); + int len = 0; + using (var _r = new StreamReader (response.GetResponseStream ())) { + char[] buf = new char [4096]; + int n; + while ((n = _r.Read (buf, 0, buf.Length)) > 0) { + /* ignore; we just want to make sure we can read */ + len += n; + } } + Assert.IsTrue (len > 0); + } catch (WebException ex) when ( + ex.Status == WebExceptionStatus.ConnectFailure || + ex.Status == WebExceptionStatus.NameResolutionFailure || + ex.Status == WebExceptionStatus.Timeout) { + Assert.Inconclusive ($"Network failure: {ex.Message}"); } - Assert.IsTrue (len > 0); } } } From 76d2109f90346176bda46f89ff8a34eec94dd1fc Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 5 May 2026 08:41:44 -0500 Subject: [PATCH 2/2] Use Assert.Ignore instead of Assert.Inconclusive to match existing pattern All other network failure handlers in this test suite use Assert.Ignore. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Mono.Android-Tests/System.Net/ProxyTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/ProxyTest.cs b/tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/ProxyTest.cs index 50853a3a601..10fb4158ed8 100644 --- a/tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/ProxyTest.cs +++ b/tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/ProxyTest.cs @@ -32,7 +32,7 @@ public void QuoteInvalidQuoteUrlsShouldWork () ex.Status == WebExceptionStatus.ConnectFailure || ex.Status == WebExceptionStatus.NameResolutionFailure || ex.Status == WebExceptionStatus.Timeout) { - Assert.Inconclusive ($"Network failure: {ex.Message}"); + Assert.Ignore ($"Ignoring network failure: {ex.Message}"); } } }