1

Resolved

Returning Task doesn't work as expected for Canceled/Faulted

description

The following two tests just hang when I run them in VS:
    [Fact]
    public Task TestCanceledTask()
    {
        TaskCompletionSource<int> source = new TaskCompletionSource<int>();
        source.SetCanceled();
        return source.Task;
    }

    [Fact]
    public Task TestFaultedTask()
    {
        TaskCompletionSource<int> source = new TaskCompletionSource<int>();
        source.SetException(new InvalidOperationException());
        return source.Task;
    }
I'd expect that instead they would fail.

I'm using VS 2013 (on Windows 8.1) with xUnit 1.9.2 and the VS xUnit runner version 0.99.0.

comments

BradWilson wrote Mar 22, 2014 at 9:10 PM

Both working as expected in v2.