Nullreference exception when accessing control

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Nullreference exception when accessing control

Post by greggorob64 » Wed Jun 11, 2014 7:55 pm

This issue is similar to my last one (index out-of-range exception) Forgive the humongous pic, i dont know of a better way to display the info. Im using Devexpress to display my lightning charts in a tile fashion. While maximizing and minimizing the chart a few times (makes the chart look like a thumbnail). I reliably get a null reference exception. Shown below is the info:

It's worth noting that no other threads are trying to modify the graph at this point.

Edit: it seems like putting the margin's settings after the endupdate seems to make the issue not show up.

Image

ArctionTero
Posts: 42
Joined: Thu Mar 28, 2013 9:20 am

Re: Nullreference exception when accessing control

Post by ArctionTero » Thu Jun 12, 2014 7:59 am

Looks like chart is trying to draw itself at that point, which should not be possible if BeginUpdate() is called at your derived class SuspendLayout() method.

Are you sure that there is no EndUpdate() call at some point after (or at) the SuspendLayout() and before Margins setter?

Sample application with source would help us to resolve this (would be nice if you could provide us with one), or are you satisfied with your current solution?
LightningChart Support Team, TK

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: Nullreference exception when accessing control

Post by greggorob64 » Thu Jun 12, 2014 1:08 pm

Ha, so i just noticed i was using begin\end update in some places, and suspend\resume layout in others.

Im mixing up my terminology. I'll try to make them all begin\end update and see if that helps

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: Nullreference exception when accessing control

Post by greggorob64 » Thu Jun 12, 2014 2:33 pm

I switching everything to use beginning/end callback, but im still having issues:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at A.OH.SH(List`1 A, Single B)
at Arction.LightningChartUltimate.LightningChartUltimate.AQC(PointLineSeriesBase A, Int32 B, Double C, Double F, Double G, GraphSegmentInfo H, Int32 I)
at Arction.LightningChartUltimate.LightningChartUltimate.ZPC(Object A)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()