public async ValueTask DisposeAsync() { if (!_disposed) { await _sourceStream.DisposeAsync(); _serviceScope.Dispose(); _disposed = true; } }
protected virtual void Dispose(bool disposing) { if (_isCompleted) { if (disposing) { _cancellationTokenSource.Cancel(); _serviceScope.Dispose(); _eventStream.Dispose(); _cancellationTokenSource.Dispose(); } _isCompleted = true; } }