public void Dispose() { lock (_dataWriterLock) { if (_disposed) { return; } _disposed = true; if (!_completed) { _completed = true; // Complete with an exception to prevent an end of stream data frame from being sent without an // explicit call to WriteStreamSuffixAsync. ConnectionAbortedExceptions are swallowed, so the // message doesn't matter _dataPipe.Writer.Complete(new ConnectionAbortedException()); } _frameWriter.AbortPendingStreamDataWrites(_flowControl); } }