Bug 28959 - WebClient DownloadFileTaskAsync pauses indefinately
Summary: WebClient DownloadFileTaskAsync pauses indefinately
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.20.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 7.2 (C10)
Assignee: Marek Habersack
Depends on:
Reported: 2015-04-09 20:43 UTC by edgar
Modified: 2016-09-22 14:42 UTC (History)
2 users (show)

Tags: XATriaged
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 edgar 2015-04-09 20:43:24 UTC
Using Xamarin Studio 5.8.2
Xamarin Android
MacOS 10.10.2
Android versions 4.1 - 5.0


When downloading a large file (> 100MB) with Webclient.DownloadFileTaskAsync every now and then the download pauses indefinitely.
No errors, no exceptions, it just halts, at a random time it seems.
This seems to happen more often at faster devices (more cores).
Happens both at WIFI and Mobile Data.
When multiple webclients are used, some might stop while others continue.

Using webClient.downloadFile always downloads the complete file.

Expected Behaviour:
Download complete file, or throw exception.

Used code:
try {
   using (WebClient client = new WebClient ()) {
	if(progressReporter != null){
	    client.DownloadProgressChanged += (s,e) => report();
	await client.DownloadFileTaskAsync(url, path));
        System.Console.WriteLine ("Download completed");
} catch (Exception ex) {
    Insights.Report (ex);
Comment 1 Marek Habersack 2016-09-22 14:42:26 UTC
Can you please test your application with the latest Xamarin.Android? The async/await framework as well as the thread pool and TPL code has been updated and large portions of it now use the .NET framework original code from reference source, which fixed quite a few bugs in this area. There's a very good chance you won't see the issue again. Please reopen the report if you still experience the problem.