Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDavid KarlasĖŒ <david.karlas@microsoft.com>2019-06-28 07:36:41 +0300
committerJeffrey Stedfast <jestedfa@microsoft.com>2019-07-03 20:25:14 +0300
commit9cbe4d88dcf23eceb17d2a929fb1628d505a749a (patch)
tree558c7a4d59a05c8f564afc9ad80a36c3650a182c /main
parent5b135742da1ecd7a7f9dbe0e0faf9b8b160c93e6 (diff)
Fix 935181: TryGetBreakpointSpan called with invalid position
I also added logic to fallback to whole line breakpoint in case Roslyn fails to find matching statement to place breakpoint on.
Diffstat (limited to 'main')
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Debugger/CSharpBreakpointSpanResolver.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Debugger/CSharpBreakpointSpanResolver.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Debugger/CSharpBreakpointSpanResolver.cs
index f21971dc9f..e3d57dcec6 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Debugger/CSharpBreakpointSpanResolver.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Debugger/CSharpBreakpointSpanResolver.cs
@@ -50,9 +50,9 @@ namespace MonoDevelop.CSharp.Debugger
var document = buffer.AsTextContainer ().GetOpenDocumentInCurrentContext ();
var tree = await document.GetSyntaxTreeAsync (cancellationToken);
- BreakpointSpans.TryGetBreakpointSpan (tree, position, cancellationToken, out var span);
-
- return new Span (span.Start, span.Length);
+ if (BreakpointSpans.TryGetBreakpointSpan (tree, Math.Max (0, Math.Min (position, tree.Length - 1)), cancellationToken, out var span))
+ return new Span (span.Start, span.Length);
+ return buffer.CurrentSnapshot.GetLineFromPosition (Math.Max (0, Math.Min (position, buffer.CurrentSnapshot.Length - 1))).Extent.Span;
}
}
}