Asynchronous socket reading: the initiating thread must not be exited - what to do?
I have a NetworkStream which I read asynchronously (using async/await) await Task<int>.Factory.FromAsync((cb, state) => stream.BeginRead(buffer, offset, readLen - offset), stream.EndRead, null); Unfortunatly, an io exception sometimes occurs: "The I/O operation has been aborted because of either a thread exit or an application request." I believe I hit a requirement documented in Socke.EndReceive: http://msdn.microsoft.com/en-us/library/w7wtt64b.aspx . Which states: All I/O initiated by a given thread is canceled when that thread exits. A pending asynchronous operation can fail if the thread