I've run the debugger on this many times in a few different pieces of code.
If you use a line such as the following in OnRender, eventually, you will get an index not found exception
stationaryXpos = chartControl.GetXByBarIndex(ChartBars, !Bars.IsTickReplay ? ChartBars.FromIndex : fbtp); // This occasionally causes an exception, yet is OK when in break mode!
So, the question is, what is unsafe about using this code in OnRender? Is it not valid to access the Bars or ChartBars objects inside OnRender? (That is where I see the issue quite regularly). Obviously, I am unable to debug this further as the exception is in the NT code, which is not available to me. Wrap it in a Try /Catch and ignore the event when it randomly occurs, and all is well, but that really is not a very good solution.
Thanks.
Comment