Reputation: 1539
In my Xamarin.Forms project, System.Net.Http.HttpClient fails with some URLs. I've got an obscure message :
System.Threading.Tasks.TaskCanceledException: A task was canceled.
I don't know how to retrieve the exact message...
Examples :
HttpClient works with :
HttpClient fails with (only in Xamarin, works elsewhere : WPF, ConsoleApp... etc) :
EDIT 1: From Xamarin.Android I have the same behaviour, whether I use HttpClient , WebClient or Restsharp.
Upvotes: 0
Views: 588
Reputation: 1539
The behaviour happens only with Visual Studio Emulator for Android, When I deploy on a google Emulator or a real device I don't have that problem. Weird cause when I use compiled code from Android Studio with these URLs it works.
I also had other problems with other URLs, I had to use ModernHttpClient.
Upvotes: 1
Reputation: 388
I strongly recommend to use Flurl. I am using it in every project, with no problem! Also, provide more informations about your error!
Upvotes: 0