Forum Xamarin.Forms

Can't Catch UnknownHostException

I am developing an application in xamarin forms that uses an api.
When the internet connection fails, it throws the exception Java.Net.UnknownHostException: Unable to resolve host ""; No address associated with hostname. The application crashes even though the code block is in a try catch.


  • LandLuLandLu Member, Xamarin Team Xamurai

    When the address can't be accessed, this exception will be thrown. But it could be caught on my side when I turn off the internet for testing:

    Moreover, Try to set the HTTP handler to Android for the native goodness:

Sign In or Register to comment.