PipeStream.EndWrite(IAsyncResult) must be called once for every call to PipeStream.BeginWrite(Byte[], int, int, AsyncCallback, object). This can be done either in the same code that called PipeStream.BeginWrite(Byte[], int, int, AsyncCallback, object) or in a callback that is passed to PipeStream.BeginWrite(Byte[], int, int, AsyncCallback, object).
Use the PipeStream.CanWrite property to determine whether the current System.IO.Pipes.PipeStream object supports write operations.
If the pipe is closed or an invalid argument is passed to PipeStream.BeginWrite(Byte[], int, int, AsyncCallback, object), the appropriate exceptions are raised immediately. Errors that occur during an asynchronous write request occur on the thread pool thread that is performing the request. The exceptions are raised when the code the calls PipeStream.EndWrite(IAsyncResult) method.