-
Notifications
You must be signed in to change notification settings - Fork 832
Closed
Description
My test runner hiccups on Debugger.Break() in tests (not surprisingly, a normal executable would do too). I was wondering if this break is intentional and serves a purpose, or was left their as a remnant of some temporary debugging situation.
Also, the |> ignore is redundant.
The test:
[<Test>]
member this.StartAsTaskCancellation () =
let cts = new CancellationTokenSource()
let tcs = TaskCompletionSource<unit>()
let a = async {
cts.CancelAfter (100)
do! tcs.Task |> Async.AwaitTask }
#if FSCORE_PORTABLE_NEW || coreclr
let t : Task<unit> =
#else
use t : Task<unit> =
#endif
Async.StartAsTask(a, cancellationToken = cts.Token)
// Should not finish
try
let result = t.Wait(300)
Assert.IsFalse (result)
with :? AggregateException -> Assert.Fail "Task should not finish, jet"
tcs.SetCanceled()
try
this.WaitASec t
with :? AggregateException as a ->
match a.InnerException with
| :? TaskCanceledException as t -> ()
| _ -> reraise()
System.Diagnostics.Debugger.Break() |> ignore
Assert.IsTrue (t.IsCompleted, "Task is not completed")I can remove this line if nobody objects.
Metadata
Metadata
Assignees
Labels
No labels