-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not clear when the return task of an async function is set to a cancelled state #775
Comments
Isn't this a BCL concern and so shouldn't be described in detail by the C# specification in the first place? |
Cancellation is also involved in IAsyncEnumerable<T> #606, in which EnumeratorCancellationAttribute needs compiler support and in my opinion should be standardised. |
At the very least, the first quoted passage shouldn't say "is put into a faulted or cancelled state as described in [section that doesn't actually describe that]", right? If the actual logic is in the BCL, then sure, it's fine if the referenced section merely refers in turn to the relevent BCL method documentation (whatever that might be), but if the logic gets open-coded then it should probably actually be described in the spec. |
If an application defines and uses a task builder type whose Perhaps 13.10.6 should say something like:
|
Fixes dotnet#775 Add a bullet to the list specifying that an `OperationCanceledException` puts the returned task in the cancelled state. This meant adding `OperationCanceledException` to the types in Annex C. I chose this fix because all known task builders conform to this behavior. It seems reasonable to standardize it.
13.10.6 The throw statement section contains the following sentence:
The linked 15.15.2 section contains only the following sentence relevant to the quoted sentence from 13.10.6:
When I read the sentence in 13.10.6, I expect that 15.15.2 explains the two things
The current text of 15.15.2 doesn't explain that difference. Even more, it doesn't mention the cancelled state at all. So, one may think that the return task is always put into a faulted state, if an exception is thrown. That is not true, as the following example shows:
So, 15.15.2 misses the description of when the return task is set to a cancelled state.
Associated WorkItem - 187389
The text was updated successfully, but these errors were encountered: