Bug 30920 - App Freeze when attempting to contact an unavailable http resource
Summary: App Freeze when attempting to contact an unavailable http resource
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.4.4
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-06-08 16:16 UTC by Cody Beyer (MSFT)
Modified: 2015-08-06 01:08 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Cody Beyer (MSFT) 2015-06-08 16:16:18 UTC
### Description

The following app attempts to make an HttpClient request to a server which is not available. In Android, this is caught with the exception handling in place. However on iOS, this just causes the app to hang.

### Sample


### Steps to Reproduce

1. Open sample app
2. Deploy to iOS Simulator
3. Click "Go" button

### Expected Results

The call will timeout, eventually throwing an exception

### Actual Results

The app will freeze and eventually crash

### Version

=== Xamarin Studio ===

Version 5.9.3 (build 1)
Installation UUID: fc65f77a-6bee-473f-8adb-6b27b14a8197
	Mono 4.0.1 ((detached/ed1d3ec)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010044

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.3.2 (7718)
Build 6D2105

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: e6ebd18
Branch: master
Build date: 2015-05-21 21:55:09-0400

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 509030001
Git revision: 5a524e1726ed103fdd4fe37e0356f2b35466ce9d
Build date: 2015-06-02 16:35:08-04
Xamarin addins: 51957cfbd06be911b212671ad05c2c6221ac90f9

=== Operating System ===

Mac OS X 10.10.3
Darwin Codys-MBP 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 1 Stephane Delcroix 2015-06-09 05:08:43 UTC
the network handlers for Httpclient might be different on different platforms, and defined with different timeouts.

you can force your own timeout by replacing your code with something like this:

            var btn = new Button {Text = "Go"};
            btn.Clicked += async (sender, args) =>
                Debug.WriteLine("*** 1");

                var url = string.Format("");

                var response = "";

					var http = new HttpClient (){
						Timeout = TimeSpan.FromSeconds(1),
					response = await http.GetStringAsync(url);
					Debug.WriteLine("*** FINISH");
                catch (Exception ex)
Comment 2 Atin 2015-08-06 01:08:12 UTC
As per Comment#1, Changing the status to VERIFIED.