diff --git a/eng/Version.Details.props b/eng/Version.Details.props index d9b4f5e7851..d85995fe268 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -19,14 +19,14 @@ This file should be imported by eng/Versions.props 1.0.0-prerelease.25467.1 1.0.0-prerelease.25467.1 - 5.0.0-2.26217.6 - 5.0.0-2.26217.6 - 5.0.0-2.26217.6 - 5.0.0-2.26217.6 - 5.0.0-2.26217.6 - 5.0.0-2.26217.6 - 5.0.0-2.26217.6 - 5.0.0-2.26217.6 + 5.0.0-2.26228.14 + 5.0.0-2.26228.14 + 5.0.0-2.26228.14 + 5.0.0-2.26228.14 + 5.0.0-2.26228.14 + 5.0.0-2.26228.14 + 5.0.0-2.26228.14 + 5.0.0-2.26228.14 9.0.0 9.0.0 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3fc9f047060..291b0662f7c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -42,37 +42,37 @@ https://github.com/dotnet/runtime 9d5a6a9aa463d6d10b0b0ba6d5982cc82f363dc3 - + https://github.com/dotnet/roslyn - 7888e0d795d36806bbaf3cecea9fc61f6aac8279 + 83e5a53ac08744260899d5012e20e1102ba87403 - + https://github.com/dotnet/roslyn - 7888e0d795d36806bbaf3cecea9fc61f6aac8279 + 83e5a53ac08744260899d5012e20e1102ba87403 - + https://github.com/dotnet/roslyn - 7888e0d795d36806bbaf3cecea9fc61f6aac8279 + 83e5a53ac08744260899d5012e20e1102ba87403 - + https://github.com/dotnet/roslyn - 7888e0d795d36806bbaf3cecea9fc61f6aac8279 + 83e5a53ac08744260899d5012e20e1102ba87403 - + https://github.com/dotnet/roslyn - 7888e0d795d36806bbaf3cecea9fc61f6aac8279 + 83e5a53ac08744260899d5012e20e1102ba87403 - + https://github.com/dotnet/roslyn - 7888e0d795d36806bbaf3cecea9fc61f6aac8279 + 83e5a53ac08744260899d5012e20e1102ba87403 - + https://github.com/dotnet/roslyn - 7888e0d795d36806bbaf3cecea9fc61f6aac8279 + 83e5a53ac08744260899d5012e20e1102ba87403 - + https://github.com/dotnet/roslyn - 7888e0d795d36806bbaf3cecea9fc61f6aac8279 + 83e5a53ac08744260899d5012e20e1102ba87403 diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs index 550ff931864..3ba6ab2a344 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs @@ -49,9 +49,10 @@ type AsyncType() = [] let mutable spinloop = true - let waitASec (t:Task) = - let result = t.Wait(TimeSpan(hours=0,minutes=0,seconds=1)) - Assert.True(result, "Task did not finish after waiting for a second.") + // Use a generous timeout to avoid flaky failures on loaded CI machines where the thread pool may be saturated. + let waitForCompletion (t: Task) = + let result = t.Wait(TimeSpan.FromSeconds(30.0)) + Assert.True(result, "Task did not finish after waiting for 30 seconds.") [] member _.AsyncRunSynchronouslyReusesThreadPoolThread() = @@ -153,34 +154,41 @@ type AsyncType() = member _.CreateTask () = let s = "Hello tasks!" let a = async { return s } - use t : Task = Async.StartAsTask a - waitASec t + let t : Task = Async.StartAsTask a + waitForCompletion t Assert.True (t.IsCompleted) Assert.AreEqual(s, t.Result) [] member _.StartAsTaskCancellation () = let cts = new CancellationTokenSource() + let asyncStarted = new ManualResetEventSlim(false) let doSpinloop () = while spinloop do () let a = async { + asyncStarted.Set() cts.CancelAfter (100) doSpinloop() } - use t : Task = Async.StartAsTask(a, cancellationToken = cts.Token) + let t : Task = Async.StartAsTask(a, cancellationToken = cts.Token) + + // Wait for the async body to actually start executing before checking timing. + Assert.True(asyncStarted.Wait(30_000), "Async body did not start within 30 seconds") + // Should not finish, we don't eagerly mark the task done just because it's been signaled to cancel. try - let result = t.Wait(300) + let result = t.Wait(1000) Assert.False (result) with :? AggregateException -> Assert.Fail "Task should not finish, yet" spinloop <- false try - waitASec t + let result = t.Wait(TimeSpan(hours=0,minutes=0,seconds=5)) + Assert.True(result, "Task did not finish after waiting for 5 seconds.") with :? AggregateException as a -> match a.InnerException with - | :? TaskCanceledException as t -> () + | :? TaskCanceledException -> () | _ -> reraise() Assert.True (t.IsCompleted, "Task is not completed") @@ -204,7 +212,7 @@ type AsyncType() = innerTcs.SetResult () try - waitASec tcs.Task + waitForCompletion tcs.Task with :? AggregateException as a -> match a.InnerException with | :? TaskCanceledException -> () @@ -247,14 +255,17 @@ type AsyncType() = [] member _.CancellationPropagatesToTask () = + let ewh = new ManualResetEvent(false) let a = async { + ewh.Set() |> Assert.True while true do () } let t = Async.StartAsTask a + ewh.WaitOne() |> Assert.True Async.CancelDefaultToken () let mutable exceptionThrown = false try - t.Wait() + waitForCompletion t with e -> exceptionThrown <- true Assert.True (exceptionThrown) Assert.True(t.IsCanceled) @@ -287,8 +298,8 @@ type AsyncType() = member _.CreateImmediateAsTask () = let s = "Hello tasks!" let a = async { return s } - use t : Task = Async.StartImmediateAsTask a - waitASec t + let t : Task = Async.StartImmediateAsTask a + waitForCompletion t Assert.True (t.IsCompleted) Assert.AreEqual(s, t.Result) @@ -296,8 +307,8 @@ type AsyncType() = member _.StartImmediateAsTask () = let s = "Hello tasks!" let a = async { return s } - use t = Async.StartImmediateAsTask a - waitASec t + let t = Async.StartImmediateAsTask a + waitForCompletion t Assert.True (t.IsCompleted) Assert.AreEqual(s, t.Result)