diff options
author | Mike Krüger <mikkrg@microsoft.com> | 2019-06-03 15:12:28 +0300 |
---|---|---|
committer | Mike Krüger <mikkrg@microsoft.com> | 2019-06-04 11:41:58 +0300 |
commit | 68e5f0a34d09b1d4c42de3ff279d9f7eedd39e92 (patch) | |
tree | 8bfe367dcd52072e95c211ffcdafaf62d6304233 /main/src/addins | |
parent | 2adc4c688539386a99182246487a90983bd81d84 (diff) |
Fixes VSTS Bug 904321: [Feedback] Xamarin Android Breakpoint not work
in debug
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/904321
Exception from feedback ticket :
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/896686
Produces many out of range exceptions in text segment marker. This
checks now for empty lines - can happen during an edit session when a
line is cleared. Exceptions in that case prevent further drawing in
that line. This is now changed and the drawing code is hardened
against exceptions in line markers.
Diffstat (limited to 'main/src/addins')
-rw-r--r-- | main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs index 6754d0b0ce..6fb760ace8 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs @@ -1957,7 +1957,7 @@ namespace Mono.TextEditor } } - var metrics = new LineMetrics { + var metrics = new LineMetrics { LineSegment = line, Layout = layout, @@ -1980,18 +1980,26 @@ namespace Mono.TextEditor if (!marker.IsVisible) continue; - if (marker.DrawBackground (textEditor, cr, metrics)) { - isSelectionDrawn |= (marker.Flags & TextLineMarkerFlags.DrawsSelection) == TextLineMarkerFlags.DrawsSelection; + try { + if (marker.DrawBackground (textEditor, cr, metrics)) { + isSelectionDrawn |= (marker.Flags & TextLineMarkerFlags.DrawsSelection) == TextLineMarkerFlags.DrawsSelection; + } + } catch (Exception e) { + LoggingService.LogInternalError ("Error while drawing backround marker " + marker, e); } } var textSegmentMarkers = TextDocument.OrderTextSegmentMarkersByInsertion (Document.GetVisibleTextSegmentMarkersAt (line)).ToList (); foreach (var marker in textSegmentMarkers) { - if (layout.Layout != null) + if (layout.Layout == null) + continue; + try { marker.DrawBackground (textEditor, cr, metrics, offset, offset + length); + } catch (Exception e) { + LoggingService.LogInternalError ("Error while drawing backround marker " + marker, e); + } } - if (DecorateLineBg != null) DecorateLineBg (cr, layout, offset, length, xPos, y, selectionStartOffset, selectionEndOffset); @@ -2175,17 +2183,24 @@ namespace Mono.TextEditor } } } - foreach (TextLineMarker marker in textEditor.Document.GetMarkers (line)) { - if (!marker.IsVisible) + foreach (var marker in textEditor.Document.GetMarkers (line)) { + if (!marker.IsVisible || layout.Layout == null) continue; - - if (layout.Layout != null) + try { marker.Draw (textEditor, cr, metrics); + } catch (Exception e) { + LoggingService.LogInternalError ("Error while drawing line marker " + marker, e); + } } foreach (var marker in textSegmentMarkers) { - if (layout.Layout != null) + if (layout.Layout == null) + continue; + try { marker.Draw (textEditor, cr, metrics, offset, offset + length); + } catch (Exception e) { + LoggingService.LogInternalError ("Error while drawing segment marker " + marker, e); + } } position += System.Math.Floor (layout.LastLineWidth); |