When our data is loaded and have a null value it causes crash to our app and catches an "Object reference not set to an instance of an object".
But this issue is only happening on iOS platform. Can someone help me this is a crucial issue for me and my team.
public
class
NumericalData
{
public
object
XData {
get
;
set
; }
public
double
? YData {
get
;
set
; }
}
{System.NullReferenceException: Object reference not set to an instance of an object
at Telerik.XamarinForms.ChartRenderer.iOS.ManagedChartDataSource.AddPoints (TelerikUI.TKChartSeries series, System.Collections.IList newItems) [0x00196] in <22603cf6132d4ae9966514a9a3d3a88a>:0
at Telerik.XamarinForms.ChartRenderer.iOS.BaseChartRenderer`1[T].Telerik.XamarinForms.Chart.IChartRenderer.OnSeriesSourceCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e, System.Object series) [0x0004e] in <22603cf6132d4ae9966514a9a3d3a88a>:0
at Telerik.XamarinForms.Chart.ChartSeries.OnItemsSourceCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00017] in <22603cf6132d4ae9966514a9a3d3a88a>:0
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:263
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:338
at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x0001a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:196
at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs:71
at NutritionalFitness.Mobile.ViewModels.ProgramPhaseViewModel.SetGraphsData (System.Collections.Generic.IEnumerable`1[T] weightIns, System.Collections.Generic.IEnumerable`1[T] waterIntakes) [0x00152] in D:\Work\NutritionalFitness\NutritionalFitness.Dev\NutritionalFitnessMobile\NutritionalFitness.Mobile\ViewModels\ProgramPhaseViewModel.cs:184
at NutritionalFitness.Mobile.ViewModels.ProgramPhaseViewModel.SetProgramPhaseComponents () [0x002d4] in D:\Work\NutritionalFitness\NutritionalFitness.Dev\NutritionalFitnessMobile\NutritionalFitness.Mobile\ViewModels\ProgramPhaseViewModel.cs:90 }
It seems to be related to the LabelBinding of LineSeries. IF a LabelFormat is not set for the LineSeries, then a NullReferenceException occurs (within ManagedChartDataSource.AddPoints). However, as a workaround, if a LabelFormat is specified (even if ShowLabels=false), then the null values produce gaps in the chart data points, as one would expect.
Hi Aaron,
I checked the discussed here bug report and I am not able to reproduce the issue with our latest release. Would it be possible top open a support ticket and send us some code snippets showing the exact setup you have. Thank you in advance.