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. Image for the cookie policy date
close icon

NullReferenceException When Create DoughnutSeries / PieSeries

var series = new Com.Syncfusion.Charts.DoughnutSeries();
With a simple one line of code above, DoughnutSeries / PieSeries is crashing on Xamarin.Android with the following stack trace:
System.NullReferenceException: Object reference not set to an instance of an object.
SfChartResources.GetString (System.Globalization.CultureInfo culture, System.String text, System.Int32 resourceID) SfChartResources.get_Others ()
Com.Syncfusion.Charts.CircularSeries..ctor () [0x0008c] in <23b7b85cad50489abf0f061166792c75>:0
Com.Syncfusion.Charts.PieSeries..ctor () [0x00000] in <23b7b85cad50489abf0f061166792c75>:0
Com.Syncfusion.Charts.DoughnutSeries..ctor () [0x0004e] in <23b7b85cad50489abf0f061166792c75>:0

BarSeries and ColumnSeries can initialized without any problem on Xamarin.Android.
I tested on Android 6 and with Syncfusion.Xamarin.SfChart.Android version nuget package.
I tried to use a few previous / older version, but they all also have the same problem on DoughnutSeries / PieSeries.

4 Replies

OK Ooi Keng Siang December 20, 2019 01:33 AM UTC

1 additional finding. If the view show a BarSeries / ColumnSeries chart first then only show DoughnutSeries / PieSeries chart then it work without crash.

HM Hemalatha Marikumar Syncfusion Team December 20, 2019 01:08 PM UTC

Hi Ooi Keng Siang, 
Greetings from Syncfusion. 
We have checked the reported issue and we can resolve this issue by initializing the SfChart instance first and then initialize the Doughnut series as per in below code snippet, 
//Initialize the SfChart instance first 
SfChart chart = new SfChart(this); 
DoughnutSeries series = new DoughnutSeries(); 
We would like to let you know that the reported issue is an already known issue and currently we are fixed the same. The fix will be included in our Weekly Nuget release which is expected to be rolled out on December 24,2019. 
Meanwhile, please use the above provided solution and let us know if you have any other concern. 
Hemalatha M.  

OK Ooi Keng Siang December 20, 2019 02:07 PM UTC

Thanks for the workaround. It worked.

HM Hemalatha Marikumar Syncfusion Team December 23, 2019 06:02 AM UTC

Hi Ooi Keng Siang, 
Thanks for your update. 
We are glad to hear given workaround works at your end.  
We would like to let you know that we included the fix of the reported crash issue in our tomorrow (December 24,2019) rolled out weekly Nuget release.  
Please check it out and let us know if you have any other concerns. 
Hemalatha M. 

Live Chat Icon For mobile
Up arrow icon