0
 My applicatiion is crash twice and the stacktrace as below:

 Description: The process was terminated due to an unhandled exception.
 Exception Info: System.NullReferenceException
 Stack:
   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

My application use Begin/End async IO model as below:

 HttpRequest.BeginGetRequestStream(callback,context);
 singal.wait(3000);
 .......
 context.dispose();//the context contain buffer to be read and buffer to be sent and the networkstream.

Is the problem caused by the overlapped data removed by call context.dispose method when the thread start? but i must set a time to wait,otherwise the thread will be block for a long time.

Sam
  • 1
  • 1
  • 4
    It's hard to say without seeing more code and knowing what `signal` is, but this doesn't look like you are using the asynchronous Begin/End methods correctly. – Dirk Oct 13 '14 at 06:06
  • [What is a NullReferenceException and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Soner Gönül Oct 13 '14 at 06:10
  • @Dirk,singal is ManualResetEventSlim object, it is used to sync the asycn operation. – Sam Oct 13 '14 at 06:15

0 Answers0