private async Task DisposeCoreAsync(CancellationToken cancellationToken) { try { if (this.stream != null) { await this.stream.DisposeAsync(cancellationToken); } } finally { this.disposed = true; this.stream = null; } }