// Close the connection with the debugger. // // We detach from any currently connected processes, as we don't want // them to quit after we're gone. public void Close() { if (m_debugger != null) { // Disconnect from each connected process. foreach (int pid in m_pids) { try { Trace.WriteLine("attempting to detach from: " + pid); DebuggedProcess proc = m_debugger.GetProcess(pid); proc.Stop(5000); proc.Detach(); } catch (System.Exception e) { Trace.WriteLine("unable to detach: " + e.ToString()); } } m_pids.Clear(); // close the connection with the debugger. try { m_debugger.Terminate(); } catch (System.Exception e) { Trace.WriteLine("Unable to terminate debugger: " + e.ToString()); } m_debugger = null; } }