Page 1 of 1

Help with crash after EndUpdate() gets called

Posted: Fri Apr 28, 2017 10:09 pm
by JRusty15
We are using version 7.1.3.4006 of the lightning charts library in our WPF application. We have run into a bug where the user interacts with out WPF application by clicking randomly on a page. Each click generates a handful of new charts, so as you can imagine there is a lot happening. If the user clicks fast enough, the app will crash with the following error in the event viewer in Windows:

Application: QXDxAnalysis.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException

Exception Info: System.Reflection.TargetInvocationException
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Delegate.DynamicInvokeImpl(System.Object[])
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at BioRad.Applications.DX_AnalysisUI.SingleInstanceController.OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[])
at BioRad.Applications.DX_AnalysisUI.EntryPoint.Main(System.String[])

This appears to be happening at the EndUpdate() method. I'm not quite sure the best way to resolve this issue, so I was hoping to get some advice here on the forum. Thank you!

Re: Help with crash after EndUpdate() gets called

Posted: Mon May 01, 2017 1:46 pm
by ArctionPasi
Hi,

Probably it's running out of memory or graphics resources.

When getting rid of old charts, please ensure you are calling chart.Dispose(), otherwise the charts and graphics resources are not freed.

There's only a limited count of charts you can have live at a same time, depending on the system. Typically chart count is ~20 ... 200.

Re: Help with crash after EndUpdate() gets called

Posted: Mon May 01, 2017 6:21 pm
by JRusty15
The problem is that we are not creating new charts each time. We have one chart object and simply change the data for the chart as the user interacts with the UI. So I don't think we want to Dispose of the chart and create a new one. If we just change the data on the chart, does that memory get cleaned up by the CLR? Or is there something else we can do to recover that memory before re-drawing?

Re: Help with crash after EndUpdate() gets called

Posted: Mon May 01, 2017 8:09 pm
by ArctionPasi
From your description I understood you are creating new charts with clicks. If you create too many LightningCharts without disposing existing ones, it may take time until Garbage Collector collects and frees memory.

Please see if using GC.Collect() helps, before creating more charts.

How many charts do you have in total, running at same time?

If you have only one, and reusing that, it's totally OK. In that case there probably is some object that that is not collected. If you are creating large series, or fills with large textures, it's wise to call Dispose() for these too, before creating new series or fills.

Re: Help with crash after EndUpdate() gets called

Posted: Wed May 17, 2017 9:31 am
by FredWatrous
Hi,
I've had this problem all the way through version 7, and finally decided to try version 8. The Billion chart is pretty definite to create this problem, but it can occur in other charts. I generally open and run the demo project with the examples since I get the same problem with my own charts. The problem is consistantly in Arction.DirectX.dll, with both VS2015 and VS2017 on 2 PC's running Win 10.

at SharpDX.Direct3D11.DeviceContext.DrawIndexed(Int32 indexCount, Int32 startIndexLocation, Int32 baseVertexLocation)
at Arction.RenderingEngine11.RenderingEngine11.DrawRect(RectangleF rectangle, Color color)
at Arction.Wpf.Charting.LightningChartUltimate.NXC(Boolean A, Boolean C)
at Arction.Wpf.Charting.LightningChartUltimate.RVC()
at Arction.Wpf.Charting.LightningChartUltimate.QOC()
at Arction.Wpf.Charting.LightningChartUltimate.MOC()
at Arction.Wpf.Charting.LightningChartUltimate.EndUpdate()
at DemoAppWpf.ExampleBillionPoints.FeedData() in C:\ProgramData\Arction\LightningChart Ultimate SDK v.8\DemoAppWpf\ExampleBillionPoints.xaml.cs:line 379
at DemoAppWpf.ExampleBillionPoints._timer_Tick(Object sender, EventArgs e) in C:\ProgramData\Arction\LightningChart Ultimate SDK v.8\DemoAppWpf\ExampleBillionPoints.xaml.cs:line 387
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
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.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)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at DemoAppWpf.App.Main()

Sincerely,
Fred

Re: Help with crash after EndUpdate() gets called

Posted: Wed May 17, 2017 1:42 pm
by ArctionKestutis
Hello Fred,

This sound very unusual that our Demo App all examples crashes. Please check that your drivers (especially graphic drivers) are up-to-date. Could you also share DxDiag (DirectX Diagnostic Tool) output with us?

All the best,
Kestutis

Re: Help with crash after EndUpdate() gets called

Posted: Thu May 18, 2017 9:32 am
by FredWatrous
OK,
This is the file DX Diag created.
Sincerely,
Fred

Re: Help with crash after EndUpdate() gets called

Posted: Thu May 18, 2017 10:41 am
by ArctionKestutis
Hi,

What exception you actually see? Is it related to forum topic?

It looks like Intel HD Graphics driver is very old (v9.xx) and chip itself from 2011. As far as I deduce from DxDiag file, it is Intel HD Graphics 3000 model with no certificated Windows 10 drivers. However, Intel (https://downloadcenter.intel.com/product/81500 ) offers some Win7/8 drivers with v15. Please try to install that. We had multiple problems with Intel drivers in the past. If the Intel driver number starts with 9.xx or 10.xx it is not good. For example, Intel graphics don’t support Dx9 LineListPrimitives.
You could also try to run your app and our Demo with Rendering device type PreferredHardware9 or Software11 (this may help to overcome some of the drivers problem).
The common problem we see that Intel HD Graphics fragment memory, creates several fold more threads and finally runs out of memory.

P.S. The best thing would be to install dedicated Graphic card, especially for so demanding application like "Billion points example".

All the best.