Bug 11634 - Cant download more than 240 files before NameResolutionFailure
Summary: Cant download more than 240 files before NameResolutionFailure
Status: RESOLVED DUPLICATE of bug 15135
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 7.2.0 (iOS 7.1)
Assignee: Bugzilla
Depends on:
Reported: 2013-04-06 20:57 UTC by Matt Louderback
Modified: 2013-11-25 11:51 UTC (History)
6 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 Matt Louderback 2013-04-06 20:57:23 UTC
We have a program that needs to download a couple hundred files from a web server and it consistently fails out at about 240 with a NameResolutionFailure exception. We are authenticating against an Windows server with NTLM.

The mystery is that we have an Objective C library that downloads 1,000 files from the same server without any issues. So that leads me to believe this is a problem with MonoTouch (AKA Xamarin.iOS) and not a limitation of iOS.

Also, we wrote a Mac OSX Mono console app that runs the same downloads and it works fine and is not limited to 240 files. So that leads me to believe that it is not Mono but is MonoTouch.

So for now we have to wrap the Objective C library and use it to download our files instead of using .Net. I hate to do this but unless someone has a solution then that is what we will have to do for now.

Note that in this simple example we are doing the processing on the main thread but it makes no difference if we do it on a background thread and use all async calls. Also note that we are using WebClient in this simple sample but we have also used used HttpWebRequest methods as well and it makes no difference.

public partial class DownloadTestViewController : UIViewController
    public DownloadTestViewController() : base ("DownloadTestViewController", null)

    public override void ViewDidLoad()

    private bool DownloadFiles()
        NetworkCredential credential = new NetworkCredential("MyUserId", "MyPassword", "MyDomain");
        bool returnCode = false;
            int index = 0;
            List<string> urls = GetUrlsList();
            foreach (string url in urls)
                string localFilePath = BuildLocalFilePath(url);
                WebClient myWebClient = new WebClient();
                myWebClient.Credentials = credential;
                myWebClient.DownloadFile(new Uri(url), localFilePath);

                Console.WriteLine("Downnloaded file {0}", index);
        catch (WebException exc1)
            returnCode = false;
        catch (Exception exc2)
            returnCode = false;

        return returnCode;

    private string BuildLocalFilePath(string url)
        string fileName = Path.GetFileName(url);
        string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
        return Path.Combine(folderPath, fileName);


Oh, and here is the exception and stack trace from the application output.

2013-04-02 19:06:00.183 DownloadTest[8614:c07] Downnloaded file 237

2013-04-02 19:06:00.229 DownloadTest[8614:c07] Downnloaded file 238

2013-04-02 19:06:00.322 DownloadTest[8614:c07] Error: NameResolutionFailure

2013-04-02 19:06:00.335 DownloadTest[8614:c07]   at 

System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x0005e] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:852

at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:860

at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebClient.cs:1473 

at System.Net.WebClient.DownloadFileCore (System.Uri address, System.String fileName, System.Object userToken) [0x00012] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebClient.cs:306 

at System.Net.WebClient.DownloadFile (System.Uri address, System.String fileName) [0x00035] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebClient.cs:288 

This happens both on the simulator and on a device.
Comment 1 Sebastien Pouliot 2013-04-08 09:15:43 UTC
ref: http://forums.xamarin.com/discussion/comment/9590/#Comment_9590

Thanks for filing the bug. Could you tell us:

* does it _only_ happens when NTLM authentication is used ? have you tried without ?

* are you using the alpha (6.3.x) version (like mentionied on the above fields) ? or the stable version (6.2.x) or an older version ?

Note: The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Comment 3 PJ 2013-07-09 04:52:28 UTC
From the referenced forum post in comment 1, some answers:

"For answers to your questions: - We see the issue both in the simulator and the device. - We only use NTLM authentication - using version 6.1 of iOS and the simulator - We aren't doing anything fancy with files in the above test code and it gives the error every time."

Addition helpful additions here would be full version information and/or a full sample test case.
Comment 4 Yuri 2013-09-04 15:34:47 UTC
I see the same NameResolutionFailure on Android just when I try to call WCF service
Comment 5 Yuri 2013-09-04 18:00:18 UTC
In my case the problem was unstable/bad WiFi connection in the office. When I connected to good WiFi the problem was gone. I will keep an eye on it to see if it comes back.
Comment 6 PJ 2013-11-19 16:44:41 UTC
This bug was targeted for a past milestone, moving to the next non-hotfix active milestone.
Comment 8 Jonathan Pryor 2013-11-25 11:51:41 UTC
This is probably Bug #15135.

*** This bug has been marked as a duplicate of bug 15135 ***