Bug 10898 - NullReferenceException when try to download image from wrong URL
Summary: NullReferenceException when try to download image from wrong URL
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-05 04:19 UTC by Maxim
Modified: 2014-03-26 08:56 UTC (History)
3 users (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:
VERIFIED FIXED

Description Maxim 2013-03-05 04:19:01 UTC
Code:
				request = (HttpWebRequest)HttpWebRequest.Create (finalUrl);
				// Do not remove line below cause of
				// http://lists.ximian.com/pipermail/monotouch/2011-October/005628.html
//				Console.WriteLine ("url:" + finalUrl);
//				request.Proxy = GlobalProxySelection.GetEmptyWebProxy(); // Obsolete
				request.Proxy = WebRequest.DefaultWebProxy;
//				request.Proxy = WebRequest.GetSystemWebProxy();
				request.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
				var r = request.GetResponse ();

Stack:
MonoTouch.CoreFoundation.CFProxy.CFProxyTypeToEnum (type=(null)) in /Developer/MonoTouch/Source/monotouch/src/shared/CoreFoundation/CFProxySupport.cs:210
MonoTouch.CoreFoundation.CFProxy.get_ProxyType () in /Developer/MonoTouch/Source/monotouch/src/shared/CoreFoundation/CFProxySupport.cs:308
MonoTouch.CoreFoundation.CFNetwork.CFWebProxy.GetProxy (targetUri={http://img.msndev2.dev.ruwizards.com/tgk/3te/6m0/160/tgk3te6m01601p0tc8ii9luh9ps6li3k2i154j5p_srv1_medium.jpg}) in /Developer/MonoTouch/Source/monotouch/src/shared/CoreFoundation/CFProxySupport.cs:749
MonoTouch.CoreFoundation.CFNetwork.CFWebProxy.IsBypassed (targetUri={http://img.msndev2.dev.ruwizards.com/tgk/3te/6m0/160/tgk3te6m01601p0tc8ii9luh9ps6li3k2i154j5p_srv1_medium.jpg}) in /Developer/MonoTouch/Source/monotouch/src/shared/CoreFoundation/CFProxySupport.cs:795
System.Net.ServicePointManager.FindServicePoint (address={http://img.msndev2.dev.ruwizards.com/tgk/3te/6m0/160/tgk3te6m01601p0tc8ii9luh9ps6li3k2i154j5p_srv1_medium.jpg}, proxy={MonoTouch.CoreFoundation.CFNetwork.CFWebProxy}) in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/ServicePointManager.cs:308
System.Net.HttpWebRequest.GetServicePoint () in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:631
System.Net.HttpWebRequest.BeginGetResponse (callback=(null), state=(null)) in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:829
System.Net.HttpWebRequest.GetResponse () in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:859
Moments.Data.DataSource.ImageClientAsync.Download (finalUrl="http://img.msndev2.dev.ruwizards.com/tgk/3te/6m0/160/tgk3te6m01601p0tc8ii9luh9ps6li3k2i154j5p_srv1_m…") in /Users/mobile/Projects/msn/msn_client/Moments/Data/DataSource/ImageClientAsync.cs:284
Comment 1 Sebastien Pouliot 2013-03-05 16:37:53 UTC
The following code does not throw for me:

			System.Net.ServicePointManager.FindServicePoint ("http://img.msndev2.dev.ruwizards.com/tgk/3te/6m0/160/tgk3te6m01601p0tc8ii9luh9ps6li3k2i154j5p_srv1_medium.jpg", System.Net.WebRequest.DefaultWebProxy);

even with a diffferent URL (that returns a 404).

Can you give more details about the versions you use, if this happens on the simulator and/or device(s) (and which version of iOS runs on them) and if you have a proxy defined on the devices/sim.
Comment 2 Maxim 2013-03-06 00:48:45 UTC
I'm using:
Runtime:
	Mono 2.10.11 (mono-2-10/2baeee2)
	GTK 2.24.14
	GTK# (2.12.0.0)
	Package version: 210110000
Xamarin.iOS
Version: 6.2.0.65 (Business Edition)

I'm test code above in iOS simulators 5.0 and 6.0.
Comment 3 Sebastien Pouliot 2013-06-02 11:53:04 UTC
If you can still reproduce this then we'll need a complete, self-contained, test case.
Comment 4 Maxim 2013-06-03 03:51:02 UTC
Yep. Since some MonoTouch update in my enviroment the problem disappeared.
Comment 5 Mohit Kheterpal 2014-03-26 08:56:52 UTC
As per comment 4, this issue does not exist.

Hence, closing this issue.