Hello,
I am trying to use the SfChart control in an Android app, but I am getting a following exception when the page loads:
09-01 22:07:43.384 I/MonoDroid( 4191): UNHANDLED EXCEPTION:
09-01 22:07:43.443 I/MonoDroid( 4191): System.InvalidCastException: Specified cast is not valid.
09-01 22:07:43.443 I/MonoDroid( 4191): at Com.Syncfusion.Charts.SfChart.BaseInitialize () [0x0005a] in <23c1f8fa601c46c78288431beb9f175a>:0
09-01 22:07:43.443 I/MonoDroid( 4191): at Com.Syncfusion.Charts.ChartBase.Initialize () [0x00000] in <23c1f8fa601c46c78288431beb9f175a>:0
09-01 22:07:43.443 I/MonoDroid( 4191): at Com.Syncfusion.Charts.ChartBase..ctor (Android.Content.Context context) [0x0001a] in <23c1f8fa601c46c78288431beb9f175a>:0
09-01 22:07:43.443 I/MonoDroid( 4191): at Com.Syncfusion.Charts.SfChart..ctor (Android.Content.Context context) [0x00000] in <23c1f8fa601c46c78288431beb9f175a>:0
09-01 22:07:43.443 I/MonoDroid( 4191): at Syncfusion.SfChart.XForms.Droid.SfChartExt..ctor (Android.Content.Context context) [0x00000] in <23c1f8fa601c46c78288431beb9f175a>:0
09-01 22:07:43.443 I/MonoDroid( 4191): at Syncfusion.SfChart.XForms.Droid.SfChartRenderer.GetNativeChart (Syncfusion.SfChart.XForms.SfChart sfChart) [0x00029] in <23c1f8fa601c46c78288431beb9f175a>:0
09-01 22:07:43.443 I/MonoDroid( 4191): at Syncfusion.SfChart.XForms.Droid.SfChartRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e) [0x00065] in <23c1f8fa601c46c78288431beb9f175a>:0
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000f4] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:137
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:84
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:217
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:68
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:335
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:199
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:137
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Support.V4.App.FragmentManager fragmentManager) [0x00031] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:325
09-01 22:07:43.443 I/MonoDroid( 4191): at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x00008] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:67
09-01 22:07:43.443 I/MonoDroid( 4191): at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) [0x00022] in <27c17fe440cf491ba8255bcefade6e02>:0
09-01 22:07:43.443 I/MonoDroid( 4191): at (wrapper dynamic-method) System.Object:18eebdef-a37d-416e-b57b-842ea12e62f8 (intptr,intptr,intptr,intptr,intptr)
The control is used in a very basic page, without any other controls, bindings etc, just as shown in the GettingStarted section of the documentation
I have the dependencies added as here
PCL | Syncfusion.SfChart.XForms.dll
|
Android | Syncfusion.SfChart.XForms.Android.dll Syncfusion.SfChart.XForms.dll |
Version 15.3.0.29
Xamarin forms version 2.3.4.267
Android API 23
Any idea why there is such an error?
Cheers