Invalid Cast Exception: Specified cast is not valid.

Hi,

I have a simple project with Xamarin Forms to try the SfChart.

I added the references in my project (And I tried various combinations) but I haven't lucky

In the PCL I added:
     Syncfusion.Xamarin.SfChart (16.1.0.26)

In the Andriod Project:
     Syncfusion.Xamarin.SfChart  (I tried without this also)
     Syncfusion.Xamarin.Android (I tried without this also)

I have a simple sample with your Get Started but... always the exception appear.

Is it neccesary now to add some line in project Android?

Thanks.

Attachment: invalid_cast_6315b9cf.rar

5 Replies

DV Divya Venkatesan Syncfusion Team March 13, 2018 09:09 AM UTC

Hi Anonimo, 
 
Thanks for using Syncfusion products. 
 
On analyzing your screenshot, we found that you have added Syncfusion.Xamarin.SfChart.Android nuget package in Android project. We would like to let you know that it is not required to add Syncfusion.Xamarin.SfChart.Android and Syncfusion.Xamarin.SfChart.IOS nuget packages in Android and iOS projects respectively. It is only for Xamarin.iOS and Xamarin.Android projects. Please refer the following user guide to know more about the dependencies for SfChart in Xamarin.Forms platform. 
  
 
Please get back to us if you need any further assistance. 
 
Regards, 
Divya Venkatesan 
 
 



AA Anonimo Anonimo March 13, 2018 04:11 PM UTC

Thanks for your answer. However If I removed this package from Android I get the next exception:

Unhandled Exception:

System.TypeLoadException: Could not load type 'Com.Syncfusion.Charts.ChartRootLayout' from assembly 'Syncfusion.SfChart.Android, Version=16.1451.0.24, Culture=neutral, PublicKeyToken=null'.


DV Divya Venkatesan Syncfusion Team March 14, 2018 05:28 AM UTC

Hi Anonimo 
 
We suspect that SfChart assemblies are not referred properly in respective projects of your application.   
   
Please refer the following user guide to know more about the dependencies for Xamarin.Forms platform.   
   
Could you please check whether Syncfusion.SfChart.XForms.dll referenced in PCL project and Syncfusion.SfChart.XForms.Android.dll and Syncfusion.SfChart.XForms.dll are referenced in Android project of your application as in the below screenshot? 
 
 
 
Note: Please clean and rebuild your application once the assemblies are referred properly in respective projects. 
 
Please let us know, if you need any further assistance on this. 
 
Regards, 
Divya Venkatesan 
 



CA Carlos March 16, 2018 12:46 PM UTC

Thanks for your support.

I clean the solution and rebuild. It's work !!

Thanks.


DV Divya Venkatesan Syncfusion Team March 19, 2018 10:24 AM UTC

Hi Anonimo,

Thanks for the update. We are glad to know that the given solution works.

Please get back to us if you need any further assistance.

Regards
Divya Venkatesan

Loader.
Up arrow icon