diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/NDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/NDebugger.cs index c9e7f52598..19f1eb14ad 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/NDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/NDebugger.cs @@ -172,20 +172,9 @@ namespace Debugger DeactivateBreakpoints(); // Detach all processes. - foreach (Process process in processCollection) { - if (!process.IsPaused) { - process.Break(); - } - process.CorProcess.Detach(); - } - - RemoveAllProcesses(); - } - - void RemoveAllProcesses() - { while (processCollection.Count > 0) { - RemoveProcess(processCollection[0]); + Process process = processCollection[0]; + process.Detach(); } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-StateControl.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-StateControl.cs index dc974b2550..c4f4786d4f 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-StateControl.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-StateControl.cs @@ -185,6 +185,16 @@ namespace Debugger RaisePausedEvents(); } + public void Detach() + { + if (IsRunning) { + corProcess.Stop(uint.MaxValue); + NotifyPaused(PausedReason.ForcedBreak); + } + corProcess.Detach(); + NotifyHasExpired(); + } + #region Convenience methods public void Continue()