public async ValueTask DisposeAsync() { // flush the pipe writer await _frameWriter.DisposeAsync() .ConfigureAwait(false); await _pipe.Writer.CompleteAsync() .ConfigureAwait(false); await _backgroundTask .ConfigureAwait(false); _cancellationTokenSource.Cancel(); _cancellationTokenSource.Dispose(); }