Skip to content

Commit 014c36f

Browse files
authored
Fix WebSockets.Client.ConnectTest crash for apple mobile platforms (#75344)
#74473 had a change where we started adding a client certificate that is not supported on apple mobile platforms. This lead to an unhandled exception in the MemberData setup of ConnectAsync_CustomInvokerWithIncompatibleWebSocketOptions_ThrowsArgumentException and resulted in an app crash. Addresses #75307
1 parent 69857ce commit 014c36f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ public static IEnumerable<object[]> ConnectAsync_CustomInvokerWithIncompatibleWe
2525
yield return NoThrow(options => options.UseDefaultCredentials = false);
2626
yield return Throw(options => options.Credentials = new NetworkCredential());
2727
yield return Throw(options => options.Proxy = new WebProxy());
28-
yield return Throw(options => options.ClientCertificates.Add(Test.Common.Configuration.Certificates.GetClientCertificate()));
28+
29+
// Will result in an exception on apple mobile platforms
30+
// and crash the test.
31+
if (PlatformDetection.IsNotAppleMobile)
32+
{
33+
yield return Throw(options => options.ClientCertificates.Add(Test.Common.Configuration.Certificates.GetClientCertificate()));
34+
}
35+
2936
yield return NoThrow(options => options.ClientCertificates = new X509CertificateCollection());
3037
yield return Throw(options => options.RemoteCertificateValidationCallback = delegate { return true; });
3138
yield return Throw(options => options.Cookies = new CookieContainer());

0 commit comments

Comments
 (0)