Update concurrent socket disposal test to accomoate UAP (dotnet/corefx#30874)
authorStephen Toub <stoub@microsoft.com>
Fri, 6 Jul 2018 21:07:51 +0000 (17:07 -0400)
committerGitHub <noreply@github.com>
Fri, 6 Jul 2018 21:07:51 +0000 (17:07 -0400)
Apparently if a socket is disposed of while it's in use, we can get an SEHException back from the P/Invoke, presumably due to the OS code trying to throw an SEH exception out of the call.  Just update the test to accomodate this when IsUap is true.

Commit migrated from https://github.com/dotnet/corefx/commit/33f1a2a0cd9c2a4a6893a0794c747f66ad2cc401

src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs

index 62e85ed..68121b2 100644 (file)
@@ -4,6 +4,7 @@
 
 using System.Collections.Generic;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Threading;
 using System.Threading.Tasks;
 using Xunit;
@@ -866,7 +867,11 @@ namespace System.Net.Sockets.Tests
                     Exception error = await Record.ExceptionAsync(() => send);
                     if (error != null)
                     {
-                        Assert.True(error is ObjectDisposedException || error is SocketException, error.ToString());
+                        Assert.True(
+                            error is ObjectDisposedException ||
+                            error is SocketException ||
+                            (error is SEHException && PlatformDetection.IsUap),
+                            error.ToString());
                     }
                 }
             }
@@ -901,7 +906,11 @@ namespace System.Net.Sockets.Tests
                     Exception error = await Record.ExceptionAsync(() => send);
                     if (error != null)
                     {
-                        Assert.True(error is ObjectDisposedException || error is SocketException, error.ToString());
+                        Assert.True(
+                            error is ObjectDisposedException ||
+                            error is SocketException ||
+                            (error is SEHException && PlatformDetection.IsUap),
+                            error.ToString());
                     }
                 }
             }