Page 1 of 1

crash when adding 'random' points to a tower series

Posted: Wed Jan 21, 2009 2:26 pm
by 13051164
Env.: TChart 3.5 / VS 2008 / .NET 2.0

Hi,

I'm adding points on the fly to a tower series. I experience crashes (NullReferenceExceptions when the chart is redrawn after point addition). It looks like it happens when points are not grouped on the X,Z plan.

Increasing NumXValues and NumZValues didn't help.
Setting IrregularGrid= true didn't help neither.

I could simulate the problem in a new project by siply creating a chart with a tower series and adding 2 points such as (40,1,15) and (30,1,20).

The only way I can workaround it is by pre-adding all possible points (41x41) with a value 0. Not ideal though because not all points are suppose to have a value.

Did I miss the obvious again? Thanks in advance for your help.

Serge.

Posted: Wed Jan 21, 2009 2:37 pm
by narcis
Hi Serge,

First of all please notice that such series work as described here.

Having said that, code below works fine for me here. Could you please modify it or send us a simple example project we can run "as-is" to reproduce the problem here?

You may post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private Steema.TeeChart.Styles.Tower tower1;

		private void InitializeChart()
		{
			tower1 = new Steema.TeeChart.Styles.Tower(tChart1.Chart);
			tower1.IrregularGrid = true;
			Random y = new Random();

			for (int x = 0; x < 10; x++)
			{
				for (int z = 0; z < 10; z++)
				{
					if (z != 5)
					{
						tower1.Add(x, y.Next(), z);
					}
					
				}
			}

			this.button1.Click += new EventHandler(button1_Click);
		}

		void button1_Click(object sender, EventArgs e)
		{
			tower1.Add(1, 1, 5);
		}
Thanks in advance.

Posted: Wed Jan 21, 2009 3:06 pm
by 13051164
Narcís,
First of all please notice that such series work as described here.
You linked to the search page !?

I uploaded a test project (testchart.zip. Contains source + exe) where I add 5 points to the chart, which seems enough to crash it (as opposed to only 2 points as I wrote earlier. It looks like the chart survives longer with IrregularGrid=true. Not much longer though!)

TIA,
Serge.

Posted: Wed Jan 21, 2009 3:40 pm
by narcis
Hi Serge,
You linked to the search page !?
Sorry, I had a lapsus and copied the wrong text :?. I wanted to post this thread:

http://www.teechart.net/support/viewtopic.php?t=5312
I uploaded a test project (testchart.zip. Contains source + exe) where I add 5 points to the chart, which seems enough to crash it (as opposed to only 2 points as I wrote earlier. It looks like the chart survives longer with IrregularGrid=true. Not much longer though!)
Thanks. The problem is reproducible with the TeeChart version you use but fine for me here using latest TeeChart for .NET v3 maintenance release available at the client area. Could you please check if it solves the problem for you?

Thanks in advance.

Posted: Thu Jan 22, 2009 10:48 am
by 13051164
Hi Narcís,

I've upgraded to the latest version. It does indeed seem to solve the problem for the test project but the problem still occurs in my real project where there are more points.

I'll do my best to reproduce the problem in the test project. In the mean time, here's the call stack when the problem occurs:

Image

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at Steema.TeeChart.Styles.Tower.DrawCell(Int32 x, Int32 z)
at Steema.TeeChart.Styles.Tower.DrawCells()
at Steema.TeeChart.Styles.Tower.Draw()
at Steema.TeeChart.Styles.Series.DrawSeries()
at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)
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.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
GCam
Assembly Version: 3.0.0.0
Win32 Version: 3.0.0.0
CodeBase: file:///C:/GCam/GCam/bin/Debug/GCam.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
ComponentFactory.Krypton.Toolkit
Assembly Version: 3.0.8.0
Win32 Version: 3.0.8.0
CodeBase: file:///C:/GCam/GCam/bin/Debug/ComponentFactory.Krypton.Toolkit.DLL
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
VideoGrabberNET
Assembly Version: 2.0.0.0
Win32 Version: 2.0.0.0
CodeBase: file:///C:/GCam/GCam/bin/Debug/VideoGrabberNET.DLL
----------------------------------------
ComponentFactory.Krypton.Ribbon
Assembly Version: 3.0.8.0
Win32 Version: 3.0.8.0
CodeBase: file:///C:/GCam/GCam/bin/Debug/ComponentFactory.Krypton.Ribbon.DLL
----------------------------------------
ComponentFactory.Krypton.Navigator
Assembly Version: 3.0.8.0
Win32 Version: 3.0.8.0
CodeBase: file:///C:/GCam/GCam/bin/Debug/ComponentFactory.Krypton.Navigator.DLL
----------------------------------------
TeeChart
Assembly Version: 3.5.3225.32185
Win32 Version: 3.5.3225.32185
CodeBase: file:///C:/GCam/GCam/bin/Debug/TeeChart.DLL
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
qx3_g7rb
Assembly Version: 3.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
fh66yjoq
Assembly Version: 3.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
ah8c3hr6
Assembly Version: 3.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
2lgaxe4l
Assembly Version: 3.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


[/img]

Posted: Thu Jan 22, 2009 11:00 am
by narcis
Hi Serge,

Thanks for your feedback. Yes, it would be very helpful if you could send us an example project with which we can reproduce the issue here and debug it.

Thanks in advance.