ArgumentOutOfRangeException TextBlock
See original GitHub issueI wasn’t able to repro it, but sometimes the start
parameter is bigger than the length of the actual string, causing this exception.
@Gillibald Any idea why this is happening?
Thanks
Update Seems like it happens only with Segoe UI font (maybe due to it taking more space than default?) Repro -
<TextBlock
DockPanel.Dock="Top"
HorizontalAlignment="Center"
TextAlignment="Left"
Margin="0,0,0,6"
FontSize="14"
MaxLines="3"
FontFamily="Segoe UI"
FontWeight="DemiBold"
TextWrapping="Wrap"
MaxWidth="320"
Text="www.htzone.co.il - מועדון הצרכנות של ההייטקיסטים and 5 more pages - Personal - Microsoft Edge" />
Application: fluentsearch.exe
CoreCLR Version: 5.0.20.47505
.NET Version: 5.0.0-rc.2.20475.5
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter ‘start’)
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.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 Blast.Program.Main(String[] args) in C:\Users\adirh\RiderProjects\Blast\Blast\Program.cs:line 85
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Thanks for all the details. Helps a lot to fix this. Having a look asap.
The crash is fixed. The RTL text wrapping has its own issue.