private async Task <bool> DeployAndRunCommandOverSSHAsync(DebuggerMode debuggerMode) { // TODO error handling // TODO show ssh output stream // TODO stop monoRemoteSshDebugTask properly try { NLogService.Logger.Info($"===== {nameof(DeployAndRunCommandOverSSHAsync)} ====="); if (!_monoExtension.IsStartupProjectAvailable()) { NLogService.Logger.Info($"No startup project/solution loaded yet."); return(false); } await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); UserSettings settings; DebugOptions debugOptions; SshDeltaCopy.Options options; CreateDebugOptions(out settings, out debugOptions, out options); if (debuggerMode.HasFlag(DebuggerMode.DeployOverSSH)) { await _monoExtension.BuildStartupProjectAsync(); await _monoExtension.CreateMdbForAllDependantProjectsAsync(HostOutputWindowEx.WriteLineLaunchError); } IDebugger debugger = settings.DeployAndDebugOnLocalWindowsSystem ? (IDebugger) new LocalWindowsDebugger() : new SSHDebugger(options); System.Threading.Tasks.Task <bool> monoRemoteSshDebugTask = null; if (debuggerMode.HasFlag(DebuggerMode.DeployOverSSH) && debuggerMode.HasFlag(DebuggerMode.DebugOverSSH)) { monoRemoteSshDebugTask = debugger.DeployRunAndDebugAsync(debugOptions, HostOutputWindowEx.WriteLaunchErrorAsync, settings.RedirectOutputOption); } else if (debuggerMode.HasFlag(DebuggerMode.DeployOverSSH)) { monoRemoteSshDebugTask = debugger.DeployAsync(debugOptions, HostOutputWindowEx.WriteLaunchErrorAsync, settings.RedirectOutputOption); } else if (debuggerMode.HasFlag(DebuggerMode.DebugOverSSH)) { monoRemoteSshDebugTask = debugger.RunAndDebugAsync(debugOptions, HostOutputWindowEx.WriteLaunchErrorAsync, settings.RedirectOutputOption); } if (debuggerMode.HasFlag(DebuggerMode.AttachProcess)) { _monoExtension.AttachDebuggerToRunningProcess(debugOptions); } if (monoRemoteSshDebugTask != null) { var myresult = await monoRemoteSshDebugTask; } return(true); } catch (Exception ex) { await HostOutputWindowEx.WriteLineLaunchErrorAsync(ex.Message); NLogService.Logger.Error(ex); MessageBox.Show(ex.Message, "VSMonoDebugger", MessageBoxButton.OK, MessageBoxImage.Error); } return(false); }