Bug 2595 - mono nunit test using WebClient receives ConnectFailure exception
Summary: mono nunit test using WebClient receives ConnectFailure exception
Status: RESOLVED INVALID
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NUnit ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2011-12-21 10:13 UTC by Jeff Marino
Modified: 2012-03-28 09:16 UTC (History)
1 user (show)

Tags:
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:
Status:
RESOLVED INVALID

Description Jeff Marino 2011-12-21 10:13:14 UTC
I'm trying to unit test some basic System.Net.WebClient code to download a string using an HTTPS endpoint.  It seems that using HTTPS from within the NUnit test fails no matter what.  I can use HTTP within the NUnit test without issue.  I can run the HTTPS code in a Console application without issue.

Here's the code...

            [Test()]
    		public void TestWebclientHttp()
    		{
    			using (System.Net.WebClient wc = new System.Net.WebClient())
    			{
    				string data = wc.DownloadString("http://maps.googleapis.com/maps/api/geocode/json?address=alvis%20court&sensor=true");
    				System.Diagnostics.Debug.WriteLine(data);
    			}			
    		}
    		
    		[Test()]
    		public void TestWebClientHttps()
    		{
    			using (System.Net.WebClient wc = new System.Net.WebClient())
    			{
    				string data = wc.DownloadString("https://maps.googleapis.com/maps/api/geocode/json?address=alvis%20court&sensor=true");
    				System.Diagnostics.Debug.WriteLine(data);
    			}
    		}

Here's the stack trace...

      

        at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x0005e] in /private/tmp/monobuild/build/BUILD/mono-2.10.6/mcs/class/System/System.Net/HttpWebRequest.cs:828 
      at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /private/tmp/monobuild/build/BUILD/mono-2.10.6/mcs/class/System/System.Net/HttpWebRequest.cs:836 
      at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.6/mcs/class/System/System.Net/WebClient.cs:1433 
      at System.Net.WebClient.ReadAll (System.Net.WebRequest request, System.Object userToken) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.6/mcs/class/System/System.Net/WebClient.cs:866 
      at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x0000a] in /private/tmp/monobuild/build/BUILD/mono-2.10.6/mcs/class/System/System.Net/WebClient.cs:246

Development Environment...

 - Mac OS X 10.6.8 
 - Mono develop 2.8.5
 - Mono runtime 2.10.6

Thanks.
Comment 1 Mike Krüger 2012-01-04 04:24:14 UTC
I don't think it's a monodevelop problem. Does it work with nunit on command line ?
Comment 2 Mike Krüger 2012-03-28 09:16:57 UTC
I get the same exception in a console application. I can't see a way that the unit tests can interfere with that.