Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Canceled task throws InvalidOperationException instead of TaskCanceledException #398

Open
n9 opened this issue Mar 5, 2015 · 0 comments

Comments

@n9
Copy link

n9 commented Mar 5, 2015

Lets have the following code:

async void Main()
{
    try
    {
        var r = await Do();
        // do someting
    }
    catch (TaskCanceledException)
    {
        // do someting when canceled
    }
}

Task<int> Do()
{
    var tcs = new TaskCompletionSource<bool>();
    tcs.SetCanceled();
    return tcs.Task;
}

It works in .NET, however not in Saltarelle.
Since await in Saltarelle will throw InvalidOperationException (actually it won't compile, as there is no TaskCanceledException in Saltarelle).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants