TextBlock TextFormatting ArgumentOutOfRangeException
See original GitHub issueWhen displaying some strings in TextBlock I am getting the exception below. I will update here once I find the problematic string.
Exception Info: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter ‘length’)
at Avalonia.Utilities.ReadOnlySlice1.Take(Int32 length) at Avalonia.Media.TextFormatting.ShapedTextCharacters.Split(Int32 length) at Avalonia.Media.TextFormatting.TextFormatterImpl.SplitTextRuns(List
1 textRuns, Int32 length)
at Avalonia.Media.TextFormatting.TextFormatterImpl.PerformTextWrapping(List1 textRuns, TextRange textRange, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak currentLineBreak) at Avalonia.Media.TextFormatting.TextFormatterImpl.FormatLine(ITextSource textSource, Int32 firstTextSourceIndex, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak) at Avalonia.Media.TextFormatting.TextLayout.UpdateLayout() at Avalonia.Media.TextFormatting.TextLayout..ctor(String text, Typeface typeface, Double fontSize, IBrush foreground, TextAlignment textAlignment, TextWrapping textWrapping, TextTrimming textTrimming, TextDecorationCollection textDecorations, Double maxWidth, Double maxHeight, Double lineHeight, Int32 maxLines, IReadOnlyList
1 textStyleOverrides)
at Avalonia.Controls.TextBlock.CreateTextLayout(Size constraint, String text)
at Avalonia.Controls.TextBlock.get_TextLayout()
at Avalonia.Controls.TextBlock.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Controls.StackPanel.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding)
at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Controls.StackPanel.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Controls.Presenters.ItemVirtualizer.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Layout.LayoutManager.Measure(ILayoutable control)
at Avalonia.Layout.LayoutManager.Measure(ILayoutable control)
at Avalonia.Layout.LayoutManager.ExecuteMeasurePass()
at Avalonia.Layout.LayoutManager.InnerLayoutPass()
at Avalonia.Layout.LayoutManager.ExecuteLayoutPass()
at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority)
at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken)
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
at Blast.Program.Main(String[] args) in C:\Users\adirh\RiderProjects\Blast\Blast\Program.cs:line 44
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (14 by maintainers)
Thanks for investigating the causing string. Will have a look shortly. My guess is that I somehow don’t handle non breaking text that needs to wrap properly.
Haven’t had any reports of such issue. So I close it for now.