dotnet / dotnet/dotnet-api-docs
System.IO.BufferedStream.ReadAsync() cancel response (exception documentation)
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
# Issue Title
System.IO.BufferedStream.ReadAsync() is responding to a cancellationToken cancel signal with System.AggregateException and not System.OperationCanceledException.
# General
The AggregateException does contain a single exception of TaskCanceledException.
docs.microsoft.com for Core, Standard, and Framework doesn't actually say any exception will be thrown on a cancel for BufferedStream or Stream. It just says the returned Task will indicate it was cancelled.
Seeing as how throwing OperationCanceledException seems like more the "convention" with most async methods, is it confirmed that Stream/BufferedStream throwing AggregateException is correct for consistency/historical reasons across Core/Standard/Framework?
If AggregateException is correct even though it goes against what seems like the "convention", I can write-up an issue for docs.microsoft.com to get this better documented.
Contributor guide
Assessment
This issue has not been assessed yet.