[MonoTouch] 100% NullReferenceException in HttpWebRequest.GetRequestStream()
Will Stones
will.stones at gmail.com
Sun Oct 9 15:40:32 EDT 2011
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.
More information about the MonoTouch
mailing list