trippsc2 / OpenTracker

An open-source cross-platform tracking application for A Link to the Past Randomizer.
MIT License
35 stars 9 forks source link

Seemingly Random Avalonia Exception #43

Closed Berserker66 closed 3 years ago

Berserker66 commented 3 years ago

So, I just had the application crash on me, closing without trace.

No error message and as far as I can tell no error log either, unless it is somewhere I didn't find it.

So, some way to report such issues in the future would be nice.

trippsc2 commented 3 years ago

Avalonia implements Serilog for logging, which I believe logs to the Windows Event Logs by default, but I haven't verified. Can you check your event logs around that time and let me know if you find anything?

Berserker66 commented 3 years ago

Ah, I think I found it:

Application: OpenTracker.exe
CoreCLR Version: 4.700.20.36602
.NET Core Version: 3.1.7
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 'length')
   at Avalonia.Utilities.ReadOnlySlice`1.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.FetchTextRuns(ITextSource textSource, Int32 firstTextSourceIndex, TextLineBreak previousLineBreak, TextLineBreak& nextLineBreak)
   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 Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
   at OpenTracker.Program.Main(String[] args) in C:\Users\JIM\Source\Repos\trippsc2\OpenTracker\OpenTracker\Program.cs:line 12

I would still recommend a better way to report such crashes, a lot of people would face trouble finding this in their windows log.

trippsc2 commented 3 years ago

It seems to be an Avalonia issue. I saw it once during development, but couldn't find the cause. I'm going to try and debug it some this evening and if I can't nail it down, I'll open an issue on the Avalonia project.

EDIT: I'm going to split logging improvements off to another issue, so I can keep track of both.

trippsc2 commented 3 years ago

This issue appears to be a known Avalonia issue that is patched in the latest commits, but not released yet. Once it is released, I'll test the new version of Avalonia and this bug should be fixed.

trippsc2 commented 3 years ago

Avalonia 0.10 preview 6 was released. I'll be upgrading the dependency and testing later tonight. If all goes well, I'll release v1.5.2 that includes upgrading the Avalonia framework to 0.10 preview 6 and addresses this issue.

trippsc2 commented 3 years ago

I left this off of the patch notes, but Avalonia 0.10 preview 6 was added to 1.5.2. This issue has been resolved.