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

[2.6.2] Canceled tasks should throw TaskCanceledException instead of InvalidOperationException #427

Open
JechoJekov opened this issue Jun 19, 2015 · 3 comments

Comments

@JechoJekov
Copy link

Currently, when waiting on a task and the task is canceled "InvalidOperationException" is thrown instead of "TaskCanceledException" as in .NET Framework. Since it is possible that the task itself throws "InvalidOperationException" during its execution the caller of the task cannot distinguish between the two cases based on the exception catch. Therefore, it would be better to throw "TaskCanceledException" to let the caller know that the task was canceled.

@JechoJekov
Copy link
Author

If you agree with the above I can prepare a pull request.

@erik-kallen
Copy link
Contributor

Full cancellation support (with cancellation tokens and everything) is already in the roslyn branch, but if you make a decent pull request we can absolutely merge that into develop

@n9
Copy link

n9 commented Jul 3, 2015

There is original issue with commit ref: #398

@erik-kallen erik-kallen added this to the 3.0 milestone Jul 24, 2015
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

3 participants