TChart crash after XAML export

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
bmb
Newbie
Newbie
Posts: 3
Joined: Wed Apr 27, 2016 12:00 am

TChart crash after XAML export

Post by bmb » Mon Dec 12, 2016 2:32 pm

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.
Attachments
TChartTest.zip
(21.09 KiB) Downloaded 737 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: TChart crash after XAML export

Post by Christopher » Tue Dec 13, 2016 11:51 am

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 9469 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.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

bmb
Newbie
Newbie
Posts: 3
Joined: Wed Apr 27, 2016 12:00 am

Re: TChart crash after XAML export

Post by bmb » Tue Dec 13, 2016 1:30 pm

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.

bmb
Newbie
Newbie
Posts: 3
Joined: Wed Apr 27, 2016 12:00 am

Re: TChart crash after XAML export

Post by bmb » Tue Dec 13, 2016 1:42 pm

Hello Christofer!

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

Please check.
Attachments
TChartTest.zip
(21.26 KiB) Downloaded 680 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: TChart crash after XAML export

Post by Christopher » Wed Dec 14, 2016 4:01 pm

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.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply