Skip to content

Critical crash: Rectangle selection crashes app (VisualLinesInvalidException) #570

@mx7b7

Description

@mx7b7

Describe the bug
Performing a rectangle selection in AvaloniaEdit (Alt + mouse)
and extending the selection to the right edge of the editor triggers a
VisualLinesInvalidException and crashes the application immediately.

Steps to reproduce

  1. Open the AvaloniaEdit demo (v12.0 RC1 or 11.4.x)
  2. Select text horizontally with Alt + mouse until you reach the right edge of the editor
  3. The app crashes immediately

Expected behavior
Rectangle selection should work correctly, even at the right edge,
without throwing an exception.

Actual behavior
The application crashes with:
Exception of type 'AvaloniaEdit.Rendering.VisualLinesInvalidException' was thrown.
at AvaloniaEdit.Rendering.TextView.get_VisualLines()
at AvaloniaEdit.Rendering.BackgroundGeometryBuilder.GetRectsForSegmentImpl(TextView textView, ISegment segment, Boolean extendToFullWidthAtLineEnd)+MoveNext()
at AvaloniaEdit.Rendering.BackgroundGeometryBuilder.AddSegment(TextView textView, ISegment segment)
at AvaloniaEdit.Editing.SelectionLayer.Render(DrawingContext drawingContext)
at Avalonia.Rendering.Composition.CompositingRenderer.UpdateCore()
at Avalonia.Rendering.Composition.CompositingRenderer.Update()
at Avalonia.Rendering.Composition.Compositor.CommitCore()
at Avalonia.Rendering.Composition.Compositor.Commit()
at Avalonia.Media.MediaContext.CommitCompositor(Compositor compositor)
at Avalonia.Media.MediaContext.CommitCompositorsWithThrottling()
at Avalonia.Media.MediaContext.RenderCore()
at Avalonia.Media.MediaContext.Render()
at Avalonia.Threading.DispatcherOperation.InvokeCore()

Notes

  • This crash happens regardless of syntax highlighting (XSHD or TextMate)
  • Older version 11.3.0 does not reproduce the crash
  • Regression appears in 11.4.x and continues in v12.0 RC1
  • App crash occurs immediately on reaching the right edge, even with a single line of text

Environment:

  • AvaloniaEdit v11.4.x and v12.0 RC1
  • AvaloniaUI v11.3.11and v12.0 RC1
  • OS: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions