Skip to content

Crash when toggling LineNumberMargin multiple times #555

@KevinHausmann

Description

@KevinHausmann

In my Windows app, the user can toggle the line number margin from the menu. It works fine, but if it is toggled multiple times, the following exception is thrown (using version AvaloniaEdit 1.4.0). It takes four or fives toggles to trigger, but it happens every time:

FATAL : Application terminated unexpectedly due to an unhandled exception System.ArgumentOutOfRangeException: The parameter value must be greater than zero. (Parameter 'emSize')
at Avalonia.Media.FormattedText.ValidateFontSize(Double emSize)
at Avalonia.Media.FormattedText..ctor(String textToFormat, CultureInfo culture, FlowDirection flowDirection, Typeface typeface, Double emSize, IBrush foreground)
at AvaloniaEdit.Utils.TextFormatterFactory.CreateFormattedText(Control element, String text, Typeface typeface, Nullable1 emSize, IBrush foreground)
at AvaloniaEdit.Editing.LineNumberMargin.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.CompositionBatchFinished(Compositor compositor, CompositionBatch batch)
at Avalonia.Media.MediaContext.<>c__DisplayClass6_0.b__1()
at Avalonia.Threading.DispatcherOperation.InvokeCore()
at Avalonia.Threading.DispatcherOperation.Execute()
at Avalonia.Threading.Dispatcher.ExecuteJob(DispatcherOperation job)
at Avalonia.Threading.Dispatcher.ExecuteJobsCore(Boolean fromExplicitBackgroundProcessingCallback)
at Avalonia.Threading.Dispatcher.Signaled()
at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
at Avalonia.Win32.Win32DispatcherImpl.RunLoop(CancellationToken cancellationToken)
at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.StartCore(String[] args)
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action1 lifetimeBuilder)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions