diff options
author | Jeffrey Stedfast <jestedfa@microsoft.com> | 2020-01-16 19:33:26 +0300 |
---|---|---|
committer | Matt Ward <ward.matt@gmail.com> | 2020-01-20 13:32:30 +0300 |
commit | 6451621fdc215c712bbf19a3dbdf1b335c3a42e6 (patch) | |
tree | e4c5e88665f5056bf905335ff88cbc6a12890520 /main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol | |
parent | dd49233341410b9eb5e04b53301615a7b5a39221 (diff) |
[Debugger] Fixed VSCodeDebuggerSession to avoid KeyNotFoundException when updating breakpoints
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/960963
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs index ff06cef278..23c4ac9e3b 100644 --- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs +++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs @@ -537,12 +537,16 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol Condition = b.ConditionExpression, HitCondition = GetHitCondition(b) }).ToList () - }, (obj) => { + }, (args) => { Task.Run (() => { - for (int i = 0; i < obj.Breakpoints.Count; i++) { - breakpoints [sourceFile.ElementAt (i)].SetStatus (obj.Breakpoints [i].Line != -1 ? BreakEventStatus.Bound : BreakEventStatus.NotBound, ""); - if (obj.Breakpoints [i].Line != sourceFile.ElementAt (i).OriginalLine) - breakpoints [sourceFile.ElementAt (i)].AdjustBreakpointLocation (obj.Breakpoints [i].Line, obj.Breakpoints [i].Column ?? 1); + for (int i = 0; i < args.Breakpoints.Count; i++) { + var breakpoint = sourceFile.ElementAt (i); + + if (breakpoints.TryGetValue (breakpoint, out var breakInfo)) { + breakInfo.SetStatus (args.Breakpoints[i].Line != -1 ? BreakEventStatus.Bound : BreakEventStatus.NotBound, ""); + if (args.Breakpoints[i].Line != breakpoint.OriginalLine) + breakInfo.AdjustBreakpointLocation (args.Breakpoints[i].Line, args.Breakpoints[i].Column ?? 1); + } } }).Ignore (); }); |