Big Red X crash
Posted: Fri Mar 04, 2005 7:57 pm
I am using the latest TeeChart.DLL (ver 1.1.1864.22788) and after several execution cycles of drawing a trend graph (adding points on the end of lines in realtime) the graph control crashes with a system exception. The crash appears as a Big Red X in the chart area with a red square outline and white background color. The jist of the exception is as follows:
This method was a result of using this forum to figure out the best way to implement these "markers".
The synchronized locks on the arraylist do not help this problem any as I have tried it with and without the locks to no avail.
I have tried the code with the current DLL listed above and the version before it with the same results.
I have also tried to generate a simple application where I could demonstrate the problem using the same graph related code from my application and cannot duplicate this problem in the simple case.
Help!
Jim
I am using the Cursor tool to put vertical lines with a text tag that follows the line. The text must be repostitioned with the line as the x-axis is changed so this is accomplished in the After Draw event. I am keeping the list of "Markers" or Cursor Tools in an ArrayList and adjusting the position via this code:System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.ArrayListEnumeratorSimple.MoveNext()
at Steema.TeeChart.Chart.BroadcastToolEvent(EventArgs e)
at Steema.TeeChart.Chart.InternalDraw(Graphics g)
at Steema.TeeChart.TChart.Draw(Graphics g)
at Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Code: Select all
private ArrayList markerLines;
private ArrayList markerLinesTS;
...
markerLines = new ArrayList();
markerLinesTS = ArrayList.Synchronized(markerLines);
...
// Inside the AfterDraw event handler
lock(markerLinesTS)
{
foreach(MarkerClass mc in markerLinesTS)
{
x = mc.CTool.GetHorizAxis.CalcXPosValue(mc.CTool.XValue);
y = (mc.CTool.GetVertAxis.CalcYPosValue(mc.CTool.GetVertAxis.MaxYValue) - (mc.CTool.GetVertAxis.CalcYPosValue(mc.CTool.GetVertAxis.MinYValue)) >> 2) + mc.CTool.GetVertAxis.CalcYPosValue(mc.CTool.GetVertAxis.MinYValue);
graphControl.Graphics3D.RotateLabel(x, y, 0, mc.MarkerText, 90);
}
Monitor.Pulse(markerLinesTS);
}
This method was a result of using this forum to figure out the best way to implement these "markers".
The synchronized locks on the arraylist do not help this problem any as I have tried it with and without the locks to no avail.
I have tried the code with the current DLL listed above and the version before it with the same results.
I have also tried to generate a simple application where I could demonstrate the problem using the same graph related code from my application and cannot duplicate this problem in the simple case.
Help!
Jim