Search code examples
xamarin.androidteechart

TeeChart for Android DateTime FormatException


I've been evaluating TeeChart for Mono/Android but every time I try to run the sample projects my emulators keep throwing exceptions:

System.FormatException: String was not recognized as a valid DateTime.
 at System.DateTime.Parse  (string,System.IFormatProvider,System.Globalization.DateTimeStyles) [0x00027] in /Users  /builder/data/lanes/monodroid-mac-4.2-series/804357b4/source/mono/mcs/class/corlib/System/DateTime.cs:830

 at System.DateTime.Parse (string,System.IFormatProvider) [0x00000] in /Users/builder/data/lanes/monodroid-mac-4.2-series/804357b4/source/mono/mcs/class/corlib/System/DateTime.cs:818

 at System.DateTime.Parse (string) [0x00000] in /Users/builder/data/lanes/monodroid-mac-4.2-series/804357b4/source/mono/mcs/class/corlib/System/DateTime.cs:813

 at Steema.TeeChart.Chart.BetaNotExpired () <IL 0x0000c, 0x000cf>

 at Steema.TeeChart.Chart.InternalDraw (Android.Graphics.Canvas) <IL 0x00001, 0x0004b>

 at Steema.TeeChart.TChart.Draw (Android.Graphics.Canvas,System.Drawing.Rectangle) <IL 0x000c4, 0x004ef>

 at Steema.TeeChart.TChart.Draw (Android.Graphics.Canvas) <IL 0x00007, 0x00097>

 at Steema.TeeChart.TChart.OnDraw (Android.Graphics.Canvas) <IL 0x00055, 0x001a3>

 at Android.Views.View.n_OnDraw_Landroid_graphics_Canvas_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-mac-4.2-series/804357b4/source/monodroid/src/Mono.Android/platforms/android-12/src/generated/Android.Views.View.cs:9297

 at (wrapper dynamic-method) object.69af4743-db01-4501-8f13-77deb4a4e86e (intptr,intptr,intptr) <IL 0x00012, 0x00033>

Based on the stack trace I'm guessing it has something to do with the BetaNotExpired and maybe a look-up value, but I just requested and received the evaluation version today. Does anyone know how to get TeeChart working?


Solution

  • Sorry, my bad. This beta release expires on July the 31st. I forgot to use a culture neutral mechanism. I used DateTime.Parse("31/07/2012") while you'd probably need DateTime.Parse("07/31/2012") or DateTime.Parse("2012/07/31"). So I changed TeeChart.Monodroid.dll to use a culture neutral mechanism converting DateTime values to universal time with DateTime.ToUniversalTime(). You can download the new assembly here. It was compiled with Mono for Android 4.2.3 beta. If necessary I could also compile it for 4.2. Please let me know if the bug fix doesn't solve the problem at your end.

    Thanks in advance.