Sam
Sam

Reputation: 1

NullReferenceException throw by CompletionPortCallback

 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.

Upvotes: 0

Views: 274

Answers (0)

Related Questions