Search code examples
.netwindowssockets

ThreadAbortException in at System.Net.UnsafeNclNativeMethods.OSSOCK.recv


Suddenly, this exception started happening in my program. Any ideas, what can be the reason?
Running on .NET 4.0

   at System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntPtr socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags)
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
   at System.Net.ConnectStream.ProcessWriteCallDone(ConnectionReturnResult returnResult)
   at System.Net.HttpWebRequest.GetResponse()
   at System.Net.WebClient.GetWebResponse(WebRequest request)
   at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream, CompletionDelegate completionDelegate, A
syncOperation asyncOp)
   at System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data)

Solution

  • There was a Thread.Abort() call deep inside of guts of the program. That was the reason.