Bug 3924 - WebClient - Incomplete download but DownloadFileCompleted is triggered without error.
Summary: WebClient - Incomplete download but DownloadFileCompleted is triggered withou...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 6.4 (async)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-03-15 17:03 UTC by Jonathan Clement
Modified: 2013-07-23 05:38 UTC (History)
6 users (show)

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


Attachments
Repro app (8.83 KB, application/zip)
2012-03-15 17:03 UTC, Jonathan Clement
Details


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:
Status:
VERIFIED FIXED

Description Jonathan Clement 2012-03-15 17:03:57 UTC
Created attachment 1523 [details]
Repro app

Configuration:

Monotouch 5.2.5
Device iOS 5.0.1

Step to reproduce:

1 - Use the repro app to download a file. 

2 - Set the url in the repro (WebClient_BugViewController.cs -> OnButtonTouchUpInside method)

3 - Start the app. Clic on the button and wait for the download to start. 

4 - Anytime before the download finishes, put the device to sleep (with the top-right hardware button).

5 - Wait some time (3-5 seconds), then wake up the device.

-> In LocalFileDownloader.cs : HandleClientDownloadFileCompleted is called even if the file is partially downloaded. AsyncCompletedEventArgs parameter has no error and is not cancelled. The application will think the downloaded file is completed, but it's not.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-03-15 19:01:26 UTC
This might be related to bug #2298.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2012-03-15 19:21:17 UTC
Yay, just downloaded a 4,7dvd in 5 seconds. 

This is the url I used: http://suse.bifi.unizar.es/opensuse/distribution/12.1/iso/openSUSE-12.1-DVD-i586.iso

Gonzalo, this looks like your area of expertise :)
Comment 3 Rolf Bjarne Kvinge [MSFT] 2012-03-15 19:21:44 UTC
Really CC.
Comment 4 Gonzalo Paniagua Javier 2012-03-16 16:11:32 UTC
This is not related to bug #2298 (I added a comment there).

I will take a look.
Comment 5 Jonathan Clement 2012-03-22 16:31:06 UTC
Our workaround is to registered to DownloadProgressChanged and keep the ProgressPercentage. When we receive DownloadFileCompleted, if ProgressPercentage < 100 then an error occurred an we don't use the downloaded file.

According to the MSND documentation, this technique will not work with ftp, but in our case, we use http.
Comment 7 Martin Baulig 2013-06-26 07:32:04 UTC
Fixed; mono/master commit c31a58b.

Note that this only works when the server set the Content-Length header.
Comment 8 narayanp 2013-07-17 10:00:52 UTC
Today I have checked this issue with following builds:

X.S 4.0.10(build 5)
Mono 3.1.2
Xamarin.iOS 6.3.8-10

We have run the attached project on device and click on 'DownloadFile' button. After clicking on this button no progress appears for downloading also in application Output we are getting " WebClient_Bug[933:6e07]HandleClientDownloadFileCompleted". Please let us know how would we know about downloading start? so theat we can move further steps to verify this issue.
Comment 9 narayanp 2013-07-23 05:38:34 UTC
Today we checked this issue with following build:

Mac Lion 10.7.4
X.S 4.0.10(build 7)
Mono 3.1.2
Xamarin.iOS 6.4.0-2

And we have used attached project and used the Rolf's url. After clicking on Download button when download get started and we press the upper right button from device and then after 3-4 seconds wake up the device by pressing upper right button from device, It display Downloads Done on device and HandleClientDownloadFileCompleted is *not* called.

iOS devices:
iPhone 4 version 7.0
iPod Touch 6.0

Changing the status to verified.