[MonoTouch] 100% NullReferenceException in HttpWebRequest.GetRequestStream()
Jeff Stedfast
jeff at xamarin.com
Mon Oct 10 11:20:53 EDT 2011
Hi Robert,
I've already fixed this bug and it will be included in MonoTouch
4.2.3. When I wrote the proxy support code for MonoTouch 4.2.0, I had
missed the fact that kCFProxyTypeAutoConfigurationJavaScript was only
available in iOS 4.0 and later (all the other proxy constants are
defined for 2.0 and above).
My apologies for this bug!
Jeff
On Sun, Oct 9, 2011 at 3:40 PM, Will Stones <will.stones at gmail.com> wrote:
> Hi,
>
> Since upgrading to MonoTouch 4.2.2 and MonoDevelop 2.8 I'm experience a 100%
> NullReferenceException when making a call to
> HttpWebRequest.GetRequestStream() when running on an iOS 3.1.3 device. I've
> pasted the exception trace below.
>
> The code which reproduces the exception is as follows:
> HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
> request.UserAgent = "MyUserAgent";
> request.Timeout = 15000;
> request.KeepAlive = true;
> request.Method = "POST";
> string requestString = GetQueryString();
> byte[] postBytes = Encoding.ASCII.GetBytes(requestString);
> request.ContentLength = postBytes.Length;
> request.ContentType = "application/x-www-form-urlencoded";
> // Crashes on this line
> request.GetRequestStream().Write(postBytes, 0, postBytes.Length);
>
>
> The code used to work fine until I upgraded MT and MD (I'm afraid I've lost
> the installers for the versions I was using so I can't tell you when the
> problem was introduced).
>
> This issue is pretty critical for me...! Can anyone confirm how long a fix
> for an issue like this is likely to take? If you'd like any more info on
> this please let me know.
>
> Will
>
> [0xe374][219] <Notice>: Failed to make API call:
> System.NullReferenceException: Object reference not set to an instance of an
> object
> [0xe374][219] <Notice>: at
> MonoTouch.CoreFoundation.CFProxy.CFProxyTypeToEnum
> (MonoTouch.Foundation.NSString type) [0x00000] in <filename unknown>:0
> [0xe374][219] <Notice>: at MonoTouch.CoreFoundation.CFProxy.get_ProxyType
> () [0x00000] in <filename unknown>:0
> [0xe374][219] <Notice>: at
> MonoTouch.CoreFoundation.CFNetwork+CFWebProxy.GetProxy (System.Uri
> targetUri) [0x00000] in <filename unknown>:0
> [0xe374][219] <Notice>: at
> MonoTouch.CoreFoundation.CFNetwork+CFWebProxy.IsBypassed (System.Uri
> targetUri) [0x00000] in <filename unknown>:0
> [0xe374][219] <Notice>: at System.Net.ServicePointManager.FindServicePoint
> (System.Uri address, IWebProxy proxy) [0x00000] in <filename unknown>:0
> [0xe374][219] <Notice>: at System.Net.HttpWebRequest.GetServicePoint ()
> [0x00000] in <filename unknown>:0
> [0xe374][219] <Notice>: at System.Net.HttpWebRequest.BeginGetRequestStream
> (System.AsyncCallback callback, System.Object state) [0x00000] in <filename
> unknown>:0
> [0xe374][219] <Notice>: at System.Net.HttpWebRequest.GetRequestStream ()
> [0x00000] in <filename unknown>:0
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/100-NullReferenceException-in-HttpWebRequest-GetRequestStream-tp3888273p3888273.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
More information about the MonoTouch
mailing list