dotnet / dotnet/dotnet-api-docs
Exception timing
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
It's not clear which exceptions are thrown during the synchronous portion of the call vs. which are applied to the returned task.
For example, ArgumentNullException can be checked for synchronously, so I'd guess that's when it would be thrown; then again, there's nothing stopping the methods from deferring it.
Regarding HttpRequestException, most such exceptions have to be async, but some, such as an immediate check of whether the device is attached to a network, can be done in the sync portion. Does calling code need to be prepared for an HttpRequestException during both the sync and async portions?
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 2d060a3c-fa61-4f7d-771d-9a33c2bb3dd5
* Version Independent ID: 612cd2e0-d2d5-e0f5-6c1d-5ca962a8813d
* Content: [HttpClient.PostAsync Method (System.Net.Http)](https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.postasync?view=netframework-4.7.2#System_Net_Http_HttpClient_PostAsync_System_Uri_System_Net_Http_HttpContent_System_Threading_CancellationToken_)
* Content Source: [xml/System.Net.Http/HttpClient.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Net.Http/HttpClient.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**
Contributor guide
Assessment
This issue has not been assessed yet.