Bug 21112 - Task never returns to await on web exceptions
Summary: Task never returns to await on web exceptions
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.2.6
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Martin Baulig
Depends on:
Reported: 2014-07-03 15:51 UTC by John Miller [MSFT]
Modified: 2016-11-11 09:52 UTC (History)
3 users (show)

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

TestCase (27.39 KB, application/zip)
2014-07-03 15:51 UTC, John Miller [MSFT]

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 John Miller [MSFT] 2014-07-03 15:51:14 UTC
Created attachment 7273 [details]

### Overview: 

    When awaiting a web call that fails in the middle, the task is never completed and the code never continues.

### Steps to Reproduce: 

    1. Run the attached test case application.
    2. Press the only button the screen after the app loads.
    3. _After_ pressing the button, quickly (before the image download is complete) disconnect the network in the middle of downloading the image.

### Actual Results: 

    User never gets to completed or the exception handler. If I pause execution I see that there is a thread stuck in a WaitOne()

### Expected Results: 

    Exception caught, process resumes.

### Build Date & Platform: 

    Mono 3.6.0

### Additional Information: 

    I was not able to reproduce this, but it is likely a timing thing that I can't seem to get. The user is able to reproduce this.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2014-07-04 03:00:59 UTC
The thread stuck in WaitOne is a general timer thread, it's not directly related to anything else.

However I can reproduce the problem where nothing happens after disconnecting the network connection on device.

Reconnecting the network doesn't it complete either, so it doesn't seem to be a timeout waiting to be hit.

Martin, this looks like your area.
Comment 3 Ram Chandra 2014-07-04 09:14:39 UTC
I have checked this issue  with the steps mentioned on bug description and I observed that when I deploy the attached sample on iPad simulator and press the button and before the image download I disconnect my network(Wifi and Ethernet). I observed that XS is still in running mode and I am not getting any exception.  At this state I have wait for more then 15 minutes but I didn't get any exception.

Screencast: http://www.screencast.com/t/7qHaaWFZ

application output: https://gist.github.com/saurabh360/9ac8dc2df23c6159a09a

Environment Info:

=== Xamarin Studio ===

Version 5.1 (build 479)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
	Mono 3.4.0 ((no/63569a7)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 304000205

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.Mac ===


=== Xamarin.Android ===

Version: 4.14.0 (Business Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 87026b6
Build date: 2014-07-02 19:39:08-0400

=== Build Information ===

Release ID: 501000479
Git revision: e5a428cec75d4cc7e6e3ccd8192a3660d013e7dc
Build date: 2014-06-26 09:28:17-04
Xamarin addins: 190d93e026e17280e75a3680ef38f2630b9228d3

=== Operating System ===

Mac OS X 10.9.3
Comment 4 Martin Baulig 2014-07-29 22:20:36 UTC
I can reliably reproduce this by using a larger file (the GCC 3.0 source code should do fine) - problem is that no Exception is thrown anywhere when I put the device into airplane mode.

Not entirely sure whether iOS actually resets the connection immediately when the network goes away, need to run some tests tomorrow.  Would be interesting to see what happens if you load a large html page in Safari and put the device into aircraft mode while it's loading.
Comment 5 Ram Chandra 2014-10-29 08:31:46 UTC
As per comment 3 and comment 4, I am changing it's status to "Confirmed".
Comment 6 Martin Baulig 2016-11-11 09:52:42 UTC
Closing ancient bugs, please reopen if you're still having this problem.