LiveCharts2: My app may crash due to LiveChart

Hello. My project using Avalonia and LiveChart. I have a suspiction that crashes in my app because I updated LiveChart beta.80 to beta.300. If i’m running my app in debug mode from Visual Studio to work fine, but if i’m running publish version, getting crash of the app. If i roll back to beto.80 then work fine again. In Windows event log have a event 1026 .NET Runtime.

Application: SysMonAvalonia.exe
CoreCLR Version: 6.0.522.21309
.NET Version: 6.0.5
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException: An item with the same key has already been added. Key: [9, System.Collections.Generic.List`1[Avalonia.VisualTree.IVisual]]
   at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T )
   at System.Collections.Generic.SortedDictionary`2.Add(TKey , TValue )
   at Avalonia.Rendering.DirtyVisuals.Add(IVisual visual) in /_/src/Avalonia.Visuals/Rendering/DirtyVisuals.cs:line 61
   at Avalonia.Rendering.DeferredRenderer.AddDirty(IVisual visual) in /_/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs:line 126
   at Avalonia.Visual.InvalidateVisual() in /_/src/Avalonia.Visuals/Visual.cs:line 300
   at LiveChartsCore.SkiaSharpView.Avalonia.MotionCanvas.OnCanvasCoreInvalidated(MotionCanvas`1 sender)
   at LiveChartsCore.Motion.MotionCanvas`1.Invalidate()
   at LiveChartsCore.CartesianChart`1.Measure()
   at LiveChartsCore.Chart`1.<UpdateThrottlerUnlocked>b__144_1()
   at Avalonia.Threading.JobRunner.Job.Avalonia.Threading.JobRunner.IJob.Run() in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 193
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 37
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 283
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 210
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 65
   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 SysMonAvalonia.Program.Main(String[] args)

My ChartModel

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@hahagu probably a threading issue and maybe different to this report. I am seriously thinking on change the way tooltips work in the library, maybe you should try https://github.com/beto-rodriguez/LiveCharts2/issues/225#issuecomment-1012488255.

I will close this for now, since it seems that it is fixed win the latest version of Avalonia.

That helps a lot thanks, I actually changed the Avalonia renderer some versions ago, I will check that up.