Forum Xamarin.Forms

HttpClient timeout ignored after VS update. Is there a way to downgrade?

craigxamcraigxam Member ✭✭
edited December 2019 in Xamarin.Forms

After I updated VS Community 2019 to 16.3.7 (from 16.2?), the HttpClient.Timeout value is now ignored when calling HttpClient.GetStreamAsync() in my Android app. It seems that the timeout is 130 seconds no matter what timeout is specified. In researching this bug, it seems that this would be an issue in the Mono library. Is there a way to downgrade the Mono library to the previous version that was working? Unfortunately, I don't know exactly what version that was but I do have a working apk built from before that I might be able to use to get the version? Thanks.


Best Answer


  • JarvanJarvan Member, Xamarin Team Xamurai

    Before, the values were set to 100s for the read timeout and 120s for the connect timeout, which seemed to be a reasonable value for their purposes. However, if a developer sets HttpClient.Timeout to a value larger than our defaults, AndroidClientHandler values "win" and the connection/read time out earlier.

    The real fix would be to improve HttpClient API so that its associated client handler can access HttpClient properties, but since it's not a quick fix we can implement now, this commit bumps the default timeout values to the (unreasonable) value of 24h to make sure we use values higher than the most likely figures assigned to HttpClient.Timeout.

    Check the release notes about Visual Studio.

  • craigxamcraigxam Member ✭✭

    Thanks for the reply. I am using the "managed" HttpClient so I don't understand why the Timeout values are now being ignored when they were working properly before. I need much shorter timeouts so that it doesn't sit there for 120s if the server happens to be unavailable. Is there any easy way to go back to before 16.3?

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited December 2019

    If you need to go back to the previous release, please take a look at the following article, uninstall your current installation and install an earlier release for Visual Studio.

  • craigxamcraigxam Member ✭✭

    Unfortunately, it looks like older "Community" versions are not available. Is there a way to just downgrade "Xamarin.Android"?

    Regarding the change, was it really intentional to break the Timeout in the managed httpclient like this?

  • craigxamcraigxam Member ✭✭

    The networking changes are giving me all kinds of problems. I don't know exactly where the changes are, Xamarin.Android or Mono (or is Mono included in Xamarin.Android)? In any case, I really need to go back to VS Community 2019 version before 16.3. Is this possible in the Community edition or am I screwed? Thanks for any help.

Sign In or Register to comment.