public async Task AppendLineAsync(string line, CancellationToken ct = default(CancellationToken)) { using (await _lock.LockAsync(ct).ConfigureAwait(_taskHelper)) { if (_findFileTask != null) { var file = await _findFileTask.ConfigureAwait(_taskHelper); _findFileTask = null; _currentFileId = file.Id; _currentFileLength = file.Length; } var bytes = Encoding.UTF8.GetBytes(line + Environment.NewLine); await _dir.AppendAsync(_currentFileId, bytes, ct); _currentFileLength += bytes.Length; } }