From 37efb859f05195e059b8d631f081b8091789e10b Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 27 Jun 2014 22:28:00 +0200 Subject: [PATCH] Fix "Collection modified during enumeration" exception in Debugger.Detach(). --- src/AddIns/Debugger/Debugger.Core/NDebugger.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/AddIns/Debugger/Debugger.Core/NDebugger.cs b/src/AddIns/Debugger/Debugger.Core/NDebugger.cs index e2cc15a5a6..ed7c9e13b0 100644 --- a/src/AddIns/Debugger/Debugger.Core/NDebugger.cs +++ b/src/AddIns/Debugger/Debugger.Core/NDebugger.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using System.Threading; using Debugger.Interop; @@ -265,7 +266,7 @@ namespace Debugger public void Detach() { // Detach all processes. - foreach(Process process in this.Processes) { + foreach(Process process in this.Processes.ToArray()) { if (process == null || process.HasExited) continue; process.Detach();