Browse Source

Fixed an InvalidOperationException when a breakpoint bookmark was removed via the Toggle Breakpoint menu item. The command was removing a bookmark whilst the enumerator was still active.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3174 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 17 years ago
parent
commit
5869e66a6e
  1. 8
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

8
src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

@ -7,6 +7,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing; using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
@ -219,11 +220,12 @@ namespace ICSharpCode.SharpDevelop.Debugging
public static void ToggleBreakpointAt(IDocument document, string fileName, int lineNumber) public static void ToggleBreakpointAt(IDocument document, string fileName, int lineNumber)
{ {
foreach (Bookmark m in document.BookmarkManager.Marks) { ReadOnlyCollection<Bookmark> bookmarks = document.BookmarkManager.Marks;
BreakpointBookmark breakpoint = m as BreakpointBookmark; for (int i = bookmarks.Count - 1; i >= 0; --i) {
BreakpointBookmark breakpoint = bookmarks[i] as BreakpointBookmark;
if (breakpoint != null) { if (breakpoint != null) {
if (breakpoint.LineNumber == lineNumber) { if (breakpoint.LineNumber == lineNumber) {
document.BookmarkManager.RemoveMark(m); document.BookmarkManager.RemoveMark(breakpoint);
return; return;
} }
} }

Loading…
Cancel
Save