public void StopCommand() { try { cancellationTokenSource.Cancel(); powerShellHost?.StopCommand(); } catch (Exception ex) { LoggingService.LogError("StopCommand error.", ex); } }