c# - Windows Mobile: exception in Finalizer terminates program -


My Windows Mobile with an exception that System.Net.HttpReadStream .

It only happens occasionally, but then it brings down the whole program. Is there anything that can do to continue the program when such an internal thriller throws? Or alternatively, how can I stop this kind of error?

Here is Staktrres exceptions (not wholly, because I have to type the whole thing ...

  ObjectDisposedException System.Threading.Timer on System.Threading.Timer.Change on .throwIfDisposed () (UInt32 dueTime, UInt32 duration) ... on System.Net.ContentLengthReadStream.doClose () on System.Net.HttpReadStream.Finalize ()  
calling code :

  HttpWebRequest request = (HttpWebRequest) WebRequest.Create (actionUrl); request.AllowAutoRedirect = true request.AllowWriteStreamBuffering truth =; request.Method = "post"; request.ContentType = "application / json ", the while (StreamWriter writer = new StreamWriter (request.GetRequestStream (use))) {JsonSerializer serializer = new JsonSerializer (); serializer.Seriali Ze (Author, myRequestObject);} (HttpWebResponse response = (HttpWebResponse) using {Using request.GetResponse ()) (StreamReader reader = new StreamReader (response.GetResponseS trim ())) {JsonSerializer serializer = new JsonSerializer ( ); MyResultObject Result = (MyResultObject) serializer.Deserialize (Reader, MyResultObject); Return result; }}  

update

The above calling code is OK. The problem was due to another HttpWebRequest , where the response was not resolved. So remember, always settle the feedback object, but in a particularly compact framework, because it can bring your whole application down!

"post-text" itemprop = "text">

This describes a similar problem.

The problem may be that you are returning to second place using the block. Thus the feedback object will not be closed.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -