private void EnsureNotRunning() { if (_isRuning) throw new InvalidOperationException("Command is already running."); }