The NetworkStream.BeginRead method may cause the InvalidOperationException exception.


When a single NetworkStream object is used by multiple threads at the same time, calling the BeginRead method may cause the InvalidOperationException exception to be thrown.


When a call to the NetworkStream.close method or NetworkStream.Dispose method of a NetworkStream object is being made, an attempt to call the NetworkStream.BeginRead method of the same NetworkStream object from another thread may throw the InvalidOperationException.


When InvalidOperationException is thrown, destroy the NetworkStream object.

More Information

This is by design behavior.

For more information on the NetworkStream.BeginRead method, refer to the following Microsoft Web site: