Disable InvokeOnEventsThreadRunsAsynchronously test on netfx (dotnet/corefx#38662)
authorStephen Toub <stoub@microsoft.com>
Wed, 19 Jun 2019 02:25:24 +0000 (22:25 -0400)
committerGitHub <noreply@github.com>
Wed, 19 Jun 2019 02:25:24 +0000 (22:25 -0400)
And avoid the whole suite from hanging by changing an ~3hr timeout to a 30s timeout.

Commit migrated from https://github.com/dotnet/corefx/commit/818465ad8624c0231262dba6e7c3a0fc4ca42a7a

src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEvents.InvokeOnEventsThread.cs
src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEventsTest.cs

index 82e7087..38bc53f 100644 (file)
@@ -14,12 +14,13 @@ namespace Microsoft.Win32.SystemEventsTests
 {
     public class InvokeOnEventsThreadTests : SystemEventsTest
     {
+        [ActiveIssue(38661, TargetFrameworkMonikers.NetFramework)]
         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
         public void InvokeOnEventsThreadRunsAsynchronously()
         {
             var invoked = new AutoResetEvent(false);
             SystemEvents.InvokeOnEventsThread(new Action(() => invoked.Set()));
-            Assert.True(invoked.WaitOne(PostMessageWait * SystemEventsTest.ExpectedEventMultiplier));
+            Assert.True(invoked.WaitOne(PostMessageWait));
         }
 
         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
@@ -44,7 +45,7 @@ namespace Microsoft.Win32.SystemEventsTests
                     actualThreadId = Thread.CurrentThread.ManagedThreadId;
                     invoked.Set();
                 }));
-                Assert.True(invoked.WaitOne(PostMessageWait * SystemEventsTest.ExpectedEventMultiplier));
+                Assert.True(invoked.WaitOne(PostMessageWait));
                 Assert.Equal(expectedThreadId, actualThreadId);
             }
             finally
index f3df79a..c9c9d60 100644 (file)
@@ -13,7 +13,7 @@ namespace Microsoft.Win32.SystemEventsTests
     {
         IntPtr s_hwnd = IntPtr.Zero;
 
-        public const int PostMessageWait = 10000;
+        public const int PostMessageWait = 30_000;
         public const int ExpectedEventMultiplier = 1000;
         public const int UnexpectedEventMultiplier = 10;
 
@@ -56,7 +56,7 @@ namespace Microsoft.Win32.SystemEventsTests
             {
                 // on an STA thread the HWND is created in the same thread synchronously when attaching to an event handler
                 // if we're on an MTA thread, a new thread is created to handle events and that thread creates the window, wait for it to complete.
-                Assert.True(windowReadyEvent.WaitOne(PostMessageWait * ExpectedEventMultiplier));
+                Assert.True(windowReadyEvent.WaitOne(PostMessageWait));
             }
         }
     }