protected override void Dispose(bool disposing)
{
if (disposing)
{
// Throw for further writes, but not reads. Allow reads to drain the buffered data and then return 0 for further reads.
_disposed = true;
_readWaitingForData.TrySetResult(null);
}
base.Dispose(disposing);
}