Page 1 of 1

Internal Exception

Posted: Tue Jul 23, 2019 3:32 pm
by daze507
Hi, I encounter sporadic exceptions that I cannot handle in v8.4.2 (it was not happening in v8.3.1).
It's hard to tell from which chart it comes from with certainty as we use three simultaneously (curve trace, scatterplot and heatmap) however it happens while the compenents are being drawn, unfortunately the problem cannot be reproduced at will.
Here are the exception details:

> Message: Catched a null reference exception.: Object reference not set to an instance of an object.
> Source: Arction.Wpf.Charting.LightningChartUltimate
> StackTrace: at Arction.Wpf.Charting.LightningChartUltimate.CIC(MessageSeverity A, MessageType C, Object F, String H, String I, Boolean J, Exception K)
at Arction.Wpf.Charting.LightningChartUltimate.GVC()
at Arction.Wpf.Charting.LightningChartUltimate.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.Interop.HwndSource.Process_WM_SIZE(UIElement rootUIElement, IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Interop.HwndSource.LayoutFilterMessage(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)
> TargetSite: Void CIC(Arction.Wpf.Charting.MessageSeverity, Arction.Wpf.Charting.MessageType, System.Object, System.String, System.String, Boolean, System.Exception)
-------------------- Inner Exception --------------------
> Message: Object reference not set to an instance of an object.

> Source: Arction.Wpf.Charting.LightningChartUltimate
> StackTrace: at Arction.Wpf.Charting.LightningChartUltimate.RDD(Int32 A, Int32 C, Boolean F, Boolean H, Int32 I, Double J, Double K, Double L, Rectangle M, AxisX O, Int32 P)
at Arction.Wpf.Charting.LightningChartUltimate.QDD(Int32 A, Int32 C, Boolean F, Boolean H, Int32 I, AxisX J, List`1 K)
at Arction.Wpf.Charting.LightningChartUltimate.NDD()
at Arction.Wpf.Charting.LightningChartUltimate.GVC()
> TargetSite: Void RDD(Int32, Int32, Boolean, Boolean, Int32, Double, Double, Double, System.Drawing.Rectangle, Arction.Wpf.Charting.Axes.AxisX, Int32)

Re: Internal Exception

Posted: Wed Jul 24, 2019 9:50 am
by ArctionKestutis

We may need full crash-dump or your application for testing this.
However, please make sure that you don't have one of two common mistakes in your application.
Two most common mistakes (made by LightningChart users) are Sharing objects and not Thread-safe chart update. Please check that you follow our guidelines, as otherwise it could very much lead to very unexpected behavior.
As described in User’s Manual chapter 26, Sharing objects between other objects in the same chart, or other chart instances, is not allowed. In most cases ChartMessage event reports errors of invalid object sharing cases. In addition, LightningChart requires that all the Chart properties should be updated in Main UI Thread (or at least last Chart.EndUpdate() called in UI Thread). LightningChart should be updated in the Main Thread, as for the most UI controls. When using a background thread in the application, all UI updates from the thread must go through Invoke (Control.Invoke() in WinForms, and Dispatcher.Invoke() in WPF). If chart is not updated in Main Thread user may get very random and unexpected results (including crashes and access violation). Difficulty to reproduce and change of application behavior with LightningChart version change also point toward that direction.

Please also use LightningChart debugging feature. You don’t need to wait some mysterious problem to appear in your Chart. Just subscribe to _Chart.ChartMessage event and follow/log messages. We send a lot of important information through ChartMessage, which could give clues about the cause of the problem. For example, event handler may look like this

Code: Select all

        private void _chart_ChartMessage(ChartMessageInfo info)
            string msgInfo, chartInfo, dxDiagInfo, processInfo, systemInfo;

            if (info.MessageSeverity <= MessageSeverity.Warning)
                msgInfo = info.ToString();
            else if (info.MessageSeverity == MessageSeverity.RecoverableError)
                chartInfo = ChartTools.GatherApplicationInformation(ChartTools.GatherDataOptions.GetChartInfo, info.Chart);
            else if (info.MessageSeverity == MessageSeverity.UnrecoverableError)
                chartInfo = ChartTools.GatherApplicationInformation(ChartTools.GatherDataOptions.GetChartInfo, info.Chart);
                dxDiagInfo = ChartTools.GatherApplicationInformation(ChartTools.GatherDataOptions.GetDxDiagInfo, info.Chart);

                // gathering Process or System Info is slow, use it only for critical problems
                processInfo = ChartTools.GatherApplicationInformation(ChartTools.GatherDataOptions.GetProcessInfo, info.Chart);
                systemInfo = ChartTools.GatherApplicationInformation(ChartTools.GatherDataOptions.GetSystemInfo, info.Chart);
                // gathering ALL Info is slow, use it only for critical problems
                ChartTools.GatherApplicationInformation(ChartTools.GatherDataOptions.All, info.Chart, @"D:\Temp", "LCUsupportInfo.txt");

            // save INFO string to Logs =>
Hope this helps.

Re: Internal Exception

Posted: Wed Jul 24, 2019 10:14 am
by daze507
Hi, thank you for your answer.
There may very much be a threading problem involved indeed, I will investigate on that aspect.
I will also subscribe to the messaging event to provide you with more detailed information in case the problem cannot be fixed.