1

Steps to Reproduce

  1. Setting wrong DNS at Ipad wifi setting (ex: 5.6.7.8)
  2. Run App, Request HttpClient.PostAsync
  3. App Frozen

Expected Behavior

Response Error in Catch()

Actual Behavior

App Frozen

Environment

Microsoft Visual Studio Enterprise 2019 Version 16.5.2 Xamarin.iOS and Xamarin.Mac SDK 13.16.0.11 Ipad Ios 12, 13, 14 System.Net.Http 4.3.4

I have a Xamarin.Ios application, which has a function that uses HttpClient.PostAsync In case the Ipad is setting DNS correctly, the app works normally, no problem However, when the DNS setting is wrong, the app will freeze, when running to handle HttpClient.PostAsync

At the output, I'm seeing that Task PostAsync cannot be completed (for a long time there is still no error at Catch())

I have tried on many different devices and also try on different versions of System.Net But still can't solve

1 Answers1

0

This can happen if you are running that command on the UI thread. In that case that is expected to happen. As such you need to start the process on a new thread using System.Tasks.Task.Run.

Ivan Ičin
  • 9,672
  • 5
  • 36
  • 57