Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folding crash #272

Closed
HendrikMennen opened this issue Oct 13, 2022 · 7 comments · Fixed by #273
Closed

Folding crash #272

HendrikMennen opened this issue Oct 13, 2022 · 7 comments · Fixed by #273

Comments

@HendrikMennen
Copy link

To reproduce, simply open the xml example and put <!-- in front of one of the nodes, then collapse it.
image

Unhandled exception. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
   at Avalonia.Media.TextFormatting.Unicode.Codepoint.ReadAt(ReadOnlySlice`1 text, Int32 index, Int32& count) in /_/src/Avalonia.Base/Media/TextFormatting/Unicode/Codepoint.cs:line 170
   at Avalonia.Media.TextFormatting.Unicode.LineBreakEnumerator.NextCharClass() in /_/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakEnumerator.cs:line 295
   at Avalonia.Media.TextFormatting.Unicode.LineBreakEnumerator.MoveNext() in /_/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakEnumerator.cs:line 57
   at Avalonia.Media.TextFormatting.TextFormatterImpl.TryGetLineBreak(TextRun textRun, LineBreak& lineBreak) in /_/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs:line 454
   at Avalonia.Media.TextFormatting.TextFormatterImpl.FetchTextRuns(ITextSource textSource, Int32 firstTextSourceIndex, TextEndOfLine& endOfLine, Int32& textSourceLength) in /_/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs:line 407
   at Avalonia.Media.TextFormatting.TextFormatterImpl.FormatLine(ITextSource textSource, Int32 firstTextSourceIndex, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak) in /_/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs:line 62
   at AvaloniaEdit.Rendering.TextView.BuildVisualLine(DocumentLine documentLine, TextRunProperties globalTextRunProperties, VisualLineTextParagraphProperties paragraphProperties, IReadOnlyList`1 elementGeneratorsArray, IReadOnlyList`1 lineTransformersArray, Size availableSize) in /home/hendrikm/RiderProjects/AvaloniaEdit/src/AvaloniaEdit/Rendering/TextView.cs:line 1092
   at AvaloniaEdit.Rendering.TextView.CreateAndMeasureVisualLines(Size availableSize) in /home/hendrikm/RiderProjects/AvaloniaEdit/src/AvaloniaEdit/Rendering/TextView.cs:line 976
   at AvaloniaEdit.Rendering.TextView.MeasureOverride(Size availableSize) in /home/hendrikm/RiderProjects/AvaloniaEdit/src/AvaloniaEdit/Rendering/TextView.cs:line 909
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in /_/src/Avalonia.Base/Layout/Layoutable.cs:line 520
   at Avalonia.Layout.Layoutable.Measure(Size availableSize) in /_/src/Avalonia.Base/Layout/Layoutable.cs:line 385
   at Avalonia.Layout.LayoutManager.Measure(ILayoutable control) in /_/src/Avalonia.Base/Layout/LayoutManager.cs:line 274
   at Avalonia.Layout.LayoutManager.ExecuteMeasurePass() in /_/src/Avalonia.Base/Layout/LayoutManager.cs:line 250
   at Avalonia.Layout.LayoutManager.InnerLayoutPass() in /_/src/Avalonia.Base/Layout/LayoutManager.cs:line 232
   at Avalonia.Layout.LayoutManager.ExecuteLayoutPass() in /_/src/Avalonia.Base/Layout/LayoutManager.cs:line 145
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 38
   at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 169
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 245
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 61
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209
   at AvaloniaEdit.Demo.Program.Main(String[] args) in /home/hendrikm/RiderProjects/AvaloniaEdit/src/AvaloniaEdit.Demo/Program.cs:line 13

@danipen
Copy link
Collaborator

danipen commented Oct 13, 2022

@Gillibald this is on the TextFormatterImpl ... do you think it may be fixed with the latest text engine changes (or is not related)?

@Gillibald
Copy link
Contributor

Gillibald commented Oct 13, 2022

Let me verify this.

Update: I can repro it

@Numpsy
Copy link

Numpsy commented Oct 13, 2022

Hi,

fwiw, just this afternoon I was having a go at running a simple Avalonia based tool that uses Avalonia Edit in WASM, and when i try to fold sections of text, there are some that fold ok and some that produce this exception:

image

I wasn't sure how much of this is expected to work in WASM at the moment, but from the call stack it sounds like the same of similar issue?

Thanks

@danipen
Copy link
Collaborator

danipen commented Oct 13, 2022

It seems to be the same issue.

BTW I guess syntax highlighting is not working in wasm, right?

@Numpsy
Copy link

Numpsy commented Oct 13, 2022

BTW I guess syntax highlighting is not working in wasm, right?

I hadn't tried it after seeing #201, but I just gave it a quick try, and it appeared to cause Edge to get stuck when setting the grammar (as in, it just sat there using 25% cpu until I killed it)

@danipen
Copy link
Collaborator

danipen commented Oct 13, 2022

Ok. That means it's not working yet ☺️

@danipen
Copy link
Collaborator

danipen commented Oct 14, 2022

@Numpsy @HendrikMennen could you verify if #273 fixes the issue? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants