Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to catch a timeout exception

FXamainFXamain Member ✭✭

I am working on a Xamarin Forms application that supports both android and iOS. In my application HTTPClient have a time out of 30 seconds and when there is no response with in mentioned time out, it is throwing a exception. tried to catch the exception using TaskCanceledException and TimeoutException but it was triggering none of these these exception. Please some help me by sharing more information on how we will be able to identify the time out exception in our xamarin forms application.

The exception that was caught was something line Java.IO.IOException when testing my app in android version. Any info will be helpful. Is there any one who have ran into the same issue.

Answers

  • JohnHardmanJohnHardman GBUniversity admin

    @FXamain said:
    I am working on a Xamarin Forms application that supports both android and iOS. In my application HTTPClient have a time out of 30 seconds and when there is no response with in mentioned time out, it is throwing a exception. tried to catch the exception using TaskCanceledException and TimeoutException but it was triggering none of these these exception. Please some help me by sharing more information on how we will be able to identify the time out exception in our xamarin forms application.

    The exception that was caught was something line Java.IO.IOException when testing my app in android version. Any info will be helpful. Is there any one who have ran into the same issue.

    If you go to the Output window of Visual Studio when this happens when running in the debugger, it should show details of the exception, including the type and a complete stack trace. Post that information here.

  • FXamainFXamain Member ✭✭

    Have attached the exception when we are getting the time out exception in the Xamarin Forms Android build

    https://docs.microsoft.com/en-us/dotnet/api/java.io.ioexception?view=xamarin-android-sdk-9

    Please any one share any information on how to identify a timeout exception has happened in xamarin forms for both Android and iOS

  • JohnHardmanJohnHardman GBUniversity admin

    @FXamain

    The exception that your screenshot shows is Java.IO.EOFException - if you Google that, you will get an explanation of when it occurs. If you post the full stack trace here (not just the first line), it may be possible to give you a more detailed answer.

    If you are having a similar issue on iOS, post the exception details (including the type and full stack trace) for iOS too.

  • FXamainFXamain Member ✭✭

    we are also not able to capture the exception in ios. We have attached the exception we were getting in iOS

  • JohnHardmanJohnHardman GBUniversity admin

    @FXamain said:
    we are also not able to capture the exception in ios. We have attached the exception we were getting in iOS

    Can you post the full stack trace for Android?

    For iOS, post the source code of SampleTest.Helpers.HttpHelper

Sign In or Register to comment.