You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When an axis is configured with IsVisible = false a crash occurs due to an unhandled NullReferenceException. This is common if you want to have a "End" axis hidden until a series is added which is configured to display on the right hand side axis.
To Reproduce
View Model
publicclassViewModel{public Axis[] YAxes {get;set;}=new[]{new Axis(){},new Axis(){IsVisible=false,}};public ISeries[] Series {get;set;}=new[]{newLineSeries<double>{Values=newdouble[]{2,1,3,5,3,4,6},Fill=null}};}
Now, comment out IsVisible = false in the Axis constructor in the view model. The application will no longer crash.
Expected behavior
No crash
Desktop (please complete the following information):
OS: Windows 10, .NET Framework 4.8
Additional context
The stack trace does not appear to be all that useful:
Expand to see stacktrace
System.NullReferenceException: Object reference not set to an instance of an object.
at LiveChartsCore.CartesianChart`1.Measure()
at LiveChartsCore.Chart`1.<UpdateThrottlerUnlocked>b__144_1()
at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback)
at LiveChartsCore.SkiaSharpView.WPF.Chart.LiveChartsCore.Kernel.Sketches.IChartView.InvokeOnUIThread(Action action)
at LiveChartsCore.Chart`1.<UpdateThrottlerUnlocked>b__144_0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at LiveChartsCore.Kernel.ActionThrottler.<Call>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
The text was updated successfully, but these errors were encountered:
EricEzaM
changed the title
Null Reference Exception in CartesianChart.Measure with an invisible axes and no series.
Null Reference Exception in CartesianChart.Measure with an invisible axes.
May 13, 2022
Describe the bug
When an axis is configured with IsVisible = false a crash occurs due to an unhandled NullReferenceException. This is common if you want to have a "End" axis hidden until a series is added which is configured to display on the right hand side axis.
To Reproduce
View Model
Main Window
Now, comment out
IsVisible = false
in the Axis constructor in the view model. The application will no longer crash.Expected behavior
No crash
Desktop (please complete the following information):
Additional context
The stack trace does not appear to be all that useful:
Expand to see stacktrace
The text was updated successfully, but these errors were encountered: