private async Task <bool> BuildProjectWithMDBFiles() { try { NLogService.Logger.Info($"===== {nameof(BuildProjectWithMDBFiles)} ====="); UserSettings settings; DebugOptions debugOptions; SshDeltaCopy.Options options; CreateDebugOptions(out settings, out debugOptions, out options); await _monoExtension.BuildStartupProjectAsync(); await _monoExtension.CreateMdbForAllDependantProjects(HostOutputWindowEx.WriteLineLaunchError); return(true); } catch (Exception ex) { HostOutputWindowEx.WriteLineLaunchError(ex.Message); NLogService.Logger.Error(ex); MessageBox.Show(ex.Message, "VSMonoDebugger", MessageBoxButton.OK, MessageBoxImage.Error); } return(false); }
private async Task <bool> DeployAndRunCommandOverSSH(DebuggerMode debuggerMode) { // TODO error handling // TODO show ssh output stream // TODO stop monoRemoteSshDebugTask properly try { NLogService.Logger.Info($"===== {nameof(DeployAndRunCommandOverSSH)} ====="); UserSettings settings; DebugOptions debugOptions; SshDeltaCopy.Options options; CreateDebugOptions(out settings, out debugOptions, out options); if (debuggerMode.HasFlag(DebuggerMode.DeployOverSSH)) { await _monoExtension.BuildStartupProjectAsync(); await _monoExtension.CreateMdbForAllDependantProjects(HostOutputWindowEx.WriteLineLaunchError); } var monoRemoteSshDebugTask = System.Threading.Tasks.Task.CompletedTask; if (debuggerMode.HasFlag(DebuggerMode.DeployOverSSH) && debuggerMode.HasFlag(DebuggerMode.DebugOverSSH)) { monoRemoteSshDebugTask = await SSHDebugger.DeployAndDebugAsync(options, debugOptions, HostOutputWindowEx.WriteLaunchError, settings.RedirectOutputOption); } else if (debuggerMode.HasFlag(DebuggerMode.DeployOverSSH)) { monoRemoteSshDebugTask = await SSHDebugger.DeployAsync(options, debugOptions, HostOutputWindowEx.WriteLaunchError, settings.RedirectOutputOption); } else if (debuggerMode.HasFlag(DebuggerMode.DebugOverSSH)) { monoRemoteSshDebugTask = await SSHDebugger.DebugAsync(options, debugOptions, HostOutputWindowEx.WriteLaunchError, settings.RedirectOutputOption); } if (debuggerMode.HasFlag(DebuggerMode.AttachProcess)) { _monoExtension.AttachDebuggerToRunningProcess(debugOptions); } await monoRemoteSshDebugTask; return(true); } catch (Exception ex) { HostOutputWindowEx.WriteLineLaunchError(ex.Message); NLogService.Logger.Error(ex); MessageBox.Show(ex.Message, "VSMonoDebugger", MessageBoxButton.OK, MessageBoxImage.Error); } return(false); }
private async Task <bool> DeployAndRunCommandOverSSH(bool deploy, bool startDebugger) { // TODO error handling // TODO show ssh output stream // TODO stop monoRemoteSshDebugTask properly try { if (!deploy && !startDebugger) { return(true); } var allDeviceSettings = UserSettingsManager.Instance.Load(); var settings = allDeviceSettings.CurrentUserSettings; if (deploy) { await _monoExtension.BuildSolutionAsync(); } var debugOptions = _monoExtension.CreateDebugOptions(settings, true); var options = new SshDeltaCopy.Options() { Host = settings.SSHHostIP, Port = settings.SSHPort, Username = settings.SSHUsername, Password = settings.SSHPassword, SourceDirectory = debugOptions.OutputDirectory, DestinationDirectory = settings.SSHDeployPath, RemoveOldFiles = true, PrintTimings = true, RemoveTempDeleteListFile = true, }; if (deploy) { await _monoExtension.ConvertPdb2Mdb(options.SourceDirectory, HostOutputWindowEx.WriteLineLaunchError); } System.Threading.Tasks.Task monoRemoteSshDebugTask; if (startDebugger) { if (deploy) { monoRemoteSshDebugTask = await SSHDebugger.DeployAndDebugAsync(options, debugOptions, HostOutputWindowEx.WriteLaunchError, settings.RedirectOutputOption); } else { monoRemoteSshDebugTask = await SSHDebugger.DebugAsync(options, debugOptions, HostOutputWindowEx.WriteLaunchError, settings.RedirectOutputOption); } _monoExtension.AttachDebuggerToRunningProcess(debugOptions); } else { monoRemoteSshDebugTask = await SSHDebugger.DeployAsync(options, debugOptions, HostOutputWindowEx.WriteLaunchError, settings.RedirectOutputOption); } await monoRemoteSshDebugTask; return(true); } catch (Exception ex) { HostOutputWindowEx.WriteLineLaunchError(ex.Message); NLogService.Logger.Error(ex); // TODO MessageBox MessageBox.Show(ex.Message, "MonoRemoteDebugger", MessageBoxButton.OK, MessageBoxImage.Error); } return(false); }