Page 1 of 1

TChart crash after XAML export

Posted: Mon Dec 12, 2016 2:32 pm
by 15678164
Hello!

I've got a crash after exporting TChart to XAML, bacause XAML contains Infinity and NaN coordinates. TChart version Steema TeeChart for .NET 2016 4.1.2016.10260.

Sample is attached. You need only change TeeChart.WPF reference to valid file.

Start project and click on "Export to XAML and read..." button.

Re: TChart crash after XAML export

Posted: Tue Dec 13, 2016 11:51 am
by Christopher
Hello,

The following code:

Code: Select all

		private void Button_Click(object sender, RoutedEventArgs e)
		{
			Steema.TeeChart.WPF.Export.XAMLFormat xaml = MyTChart.Export.Image.XAML;
			xaml.Width = 400;
			xaml.Height = 300;
			xaml.Save(@"G:\temp\chart.xaml");
		}
exports to file correctly. If I then copy and paste the canvas into a new Xaml page I obtain this:
xaml1.PNG
xaml1.PNG (46.09 KiB) Viewed 9375 times
I then modify the code to this:

Code: Select all

		private void Button_Click(object sender, RoutedEventArgs e)
		{
			Steema.TeeChart.WPF.Export.XAMLFormat xaml = MyTChart.Export.Image.XAML;
			xaml.Width = 400;
			xaml.Height = 300;

			MemoryStream ms = new MemoryStream();
			xaml.Save(ms);
			ms.Position = 0;
			object exportedXaml = XamlReader.Load(ms);
		}
And the XamlReader loads the stream correctly.

I think the issue is with using a Width and Height which is not big enough for all the elements you have in your chart.

Re: TChart crash after XAML export

Posted: Tue Dec 13, 2016 1:30 pm
by 15678164
Hello Christopher!

Thank you, but I'll think this problem is more global. I only made a sample to reproduce crash.

1. This sample works correctly with WPF TChart version 4.1.2015.3112, you can check. No crash!! Please check this sample with version 4.1.2015.3112.
2. After upgrade from version 4.1.2015.3112 to 4.1.2016.10260 I've got a lot of crashes because of Infinity and NaN values in exported XAML. A lot of! I created this sample only to show you that coordinate values in XAML shouldn't be Infinity and NaN, because it's impossible to read such XAML.

Re: TChart crash after XAML export

Posted: Tue Dec 13, 2016 1:42 pm
by 15678164
Hello Christofer!

I made another sample without Width and Height set. It crashes!

Please check.

Re: TChart crash after XAML export

Posted: Wed Dec 14, 2016 4:01 pm
by Christopher
Hello,
bmb wrote: 1. This sample works correctly with WPF TChart version 4.1.2015.3112, you can check. No crash!! Please check this sample with version 4.1.2015.3112.
I see, thank you for the information! I have now been able to reproduce the issue and have added to our issue tracker with id=1720.