.Net Framework v/s .Net Core - HttpClient class throws TaskCancelled instead of timeout and more

preview_player
Показать описание
This video shows how the HttpClient class behaves differently when timing out in .Net Framework v/s .Net 6.
First of all, it is not throwing the TimeoutException but TaskCancelledException.
In .Net Framework it throws TaskCancelledException without any timeout details except the IsCancellationRequested property.
In .Net core 3.1 onwards it is throwing TaskCancelledException with TimeoutException in its inner exception property. Also, the message clearly indicates the TaskCancelled due to timeout.

More details are available in the GitHub issue discussion about this change.

Рекомендации по теме
welcome to shbcf.ru