System.Runtime.Serialization.SerializationException

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
swong
Newbie
Newbie
Posts: 24
Joined: Thu Jan 15, 2004 5:00 am

System.Runtime.Serialization.SerializationException

Post by swong » Tue Feb 17, 2004 7:58 pm

I have a bound chart (ie. using DataTable, and DataColumn), and I would like to save the changes done to the chart. Unfortuntately, I get a Serialization Error if I do a Template.Save("C:\TEST.TEN"). The Serialization Error refers to a DataColumn (as not being serializable).

Is there another way to save the chart preferences?


Error is as follows:

An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll

Additional information: The type System.Data.DataColumn in Assembly System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 is not marked as serializable.

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Wed Feb 18, 2004 11:12 pm

Hello,

This is a bug, thanks for letting us know. We'll resolve it for the next maintenance release.

Regards,
Marc Meumann
Steema Support

Eamon
Newbie
Newbie
Posts: 3
Joined: Wed Jun 23, 2004 4:00 am
Location: Brisbane, Australia

Post by Eamon » Thu Jun 24, 2004 2:17 am

Hi, I have just started to use the .NET version of Teechart after a couple of years with the active x version and I have also come accross this error.

It seems to me that it only occurs however if one of the bound data colums is part of the primary key for the datasource.

the problem is that I need to use a primary key field as the data source, so my current workaround is to set the datasource for each series to null before attempting to serialise.

Though this works, it is not ideal so is there any info on when a fix might be implemented?

Eamon

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Wed Jul 14, 2004 8:18 am

Hello Eamon,

Some work was done on this. I'll check the current status and let you know about availability of a fix.

Regards,
Marc Meumann
Steema Support

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Jul 14, 2004 9:56 am

Hi --
It seems to me that it only occurs however if one of the bound data colums is part of the primary key for the datasource.

the problem is that I need to use a primary key field as the data source, so my current workaround is to set the datasource for each series to null before attempting to serialise.

Though this works, it is not ideal so is there any info on when a fix might be implemented?
A more ideal fix would be to create a typed dataset, e.g.

Code: Select all

private MemoryStream stream;
private Steema.TeeChart.Styles.Line line1;
private System.Data.DataTable dataTable1;

private void Form1_Load(object sender, System.EventArgs e) {
	commander1.Chart = tChart1;
	line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
	dataTable1 = new DataTable();
	stream = new MemoryStream();
	Random rnd = new Random();
	DataColumn xValues = new DataColumn("XValues", Type.GetType("System.Double"));
	DataColumn yValues = new DataColumn("YValues", Type.GetType("System.Double"));
	
	dataTable1.Columns.Add(xValues);
	dataTable1.Columns.Add(yValues);

	dataTable1.PrimaryKey = new DataColumn[] {xValues};

	DataRow dr;

	for(double i =0; i<10; ++i) {
		dr = dataTable1.NewRow();
		dr[xValues] = i;
		dr[yValues] = rnd.Next(100);
		dataTable1.Rows.Add(dr);
	}

	DataSet dataSet1 = new DataSet("TeeChart_Data");
	dataSet1.Tables.Add(dataTable1);

	line1.DataSource = dataSet1;
	line1.XValues.DataMember = dataSet1.Tables[0].Columns["XValues"].ToString();
	line1.YValues.DataMember = dataSet1.Tables[0].Columns["YValues"].ToString();

//	line1.DataSource = dataTable1;
//	line1.XValues.DataMember = dataTable1.Columns["XValues"].ToString();
//	line1.YValues.DataMember = dataTable1.Columns["YValues"].ToString();

	line1.CheckDataSource();

	tChart1.Export.Template.Save(stream);
	stream.Position=0;
	tChart2.Import.Template.Load(stream);
}
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply