We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Empty SfChart crashes on Android: specified cast is not valid

Thread ID:

Created:

Updated:

Platform:

Replies:

132973 Oct 2,2017 01:28 AM Oct 4,2017 02:37 AM Xamarin.Forms 3
loading
Tags: SfChart
Gianluca Esposito
Asked On October 2, 2017 01:28 AM

I'm using a SfChart control in my Xamarin Forms project (release 15.3.0.33 with Xamarin.Forms 2.4.0.282).
Just using an empty SfChart control it crashes during BaseInitialize as shown in stack trace.
Any suggestions?
Specified cast is not valid.
  • 1
    SfChart.BaseInitialize ()
  • 2
    ChartBase.Initialize ()
  • 3
    Com.Syncfusion.Charts.ChartBase..ctor (Android.Content.Context context) [0x0001a] in <35869240bce84637ac78aeb02a512071>:0
  • 4
    Com.Syncfusion.Charts.SfChart..ctor (Android.Content.Context context) [0x00000] in <35869240bce84637ac78aeb02a512071>:0
  • 5
    Syncfusion.SfChart.XForms.Droid.SfChartExt..ctor (Android.Content.Context context) [0x00000] in <35869240bce84637ac78aeb02a512071>:0
  • 6
    SfChartRenderer.GetNativeChart (Syncfusion.SfChart.XForms.SfChart sfChart)
  • 7
    SfChartRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e)
  • 8
    VisualElementRenderer`1[TElement].SetElement (TElement element) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:171
  • 9
    IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:120
  • 10
    Platform.CreateRenderer (Xamarin.Forms.VisualElement element) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:285
  • 11
    VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:86
  • 12
    VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:219
  • 13
    VisualElementPackager.Load () C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:70
  • 14
    VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:371
  • 15
    VisualElementRenderer`1[TElement].SetElement (TElement element) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:174
  • 16
    IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:120
  • 17
    Platform.CreateRenderer (Xamarin.Forms.VisualElement element) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:285
  • 18
    VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:86
  • 19
    VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:219
  • 20
    VisualElementPackager.Load () C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:70
  • 21
    VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:371
  • 22
    VisualElementRenderer`1[TElement].SetElement (TElement element) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:174
  • 23
    IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:120
  • 24
    Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Support.V4.App.FragmentManager fragmentManager) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:322
  • 25
    FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:67
  • 26
    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)
  • 27
    (wrapper dynamic-method) System.Object:0dfcc65f-a4a6-4efb-b62e-de762ac1b4f4 (intptr,intptr,intptr,intptr,intptr)

Parthiban Sundaram [Syncfusion]
Replied On October 3, 2017 12:35 AM

Hi Gianluca,

Sorry for the inconvenience caused.

Due to internal architecture change, now, it is not required to add Syncfusion.SfChart.Android.dll and Syncfusion.SfChart.iOS.dll assemblies to your platform specific projects such as Android and iOS in Xamarin.Forms respectively. Hence, you need to remove these two assemblies from your platform specific projects.

Please make sure that the following highlighted SfChart assemblies are only referred in your application.

 

Release notes: https://help.syncfusion.com/xamarin/release-notes/v15.3.0.26?type=all#breaking-changes  

UG: https://help.syncfusion.com/xamarin/introduction/control-dependencies  

Note: Clean and Rebuild the projects after remove the assemblies.

Please let us know, if you need further assistance on this.

Regards,
Parthiban S
 


Gianluca Esposito
Replied On October 3, 2017 12:55 AM

Everything works fine!

Thank you very much


Parthiban Sundaram [Syncfusion]
Replied On October 4, 2017 02:37 AM

Hi Gianluca,

Thanks for the update. We are glad that the given solution has helped to resolved the issue. Please let us know, if you need further assistance on this.

Regards,
Parthiban S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;