Hi there,
I'm struggling to get the ListView working on my iOS devices. On the simulator these work fine, but on the devices i keep getting this error;
NullReferenceException: Object reference not set to an instance of an object
on the following line in my Main.cs file (same as the default xamarin one);
UIApplication.Main(args, null, "AppDelegate");
here's the stack trace
at Telerik.XamarinForms.DataControlsRenderer.iOS.ListView.UIListViewCell.UpdateSelectionViewStyle () [0x000b5] in <
69c148d17a40435da18b2f1c1ff180c5
>:0
at Telerik.XamarinForms.DataControlsRenderer.iOS.ListView.UIListViewCell.UpdateCell (Telerik.XamarinForms.DataControls.RadListView owner, System.Object dataItem) [0x0005a] in <
69c148d17a40435da18b2f1c1ff180c5
>:0
at Telerik.XamarinForms.DataControlsRenderer.iOS.ListViewDataSource.InitCell (TelerikUI.TKListView listView, Foundation.NSIndexPath indexPath, TelerikUI.TKListViewCell tkCell, Foundation.NSObject obj) [0x000f5] in <
69c148d17a40435da18b2f1c1ff180c5
>:0
at ObjCRuntime.Trampolines+SDActionArity4V1.Invoke (System.IntPtr block, System.IntPtr arg1, System.IntPtr arg2, System.IntPtr arg3, System.IntPtr arg4) [0x00033] in <
9e260fcc0dbf47638fe447f503155067
>:0
at (wrapper native-to-managed) ObjCRuntime.Trampolines+SDActionArity4V1:Invoke (intptr,intptr,intptr,intptr,intptr)
12 Answers, 1 is accepted
further investigations; i can create a RadListView in XAML like so; and this works...
<dataControls:RadListView x:Name="customerListView" BackgroundColor="White" IsPullToRefreshEnabled="True">
Adding ItemsSource causes my application to crash as soon as the page starts to load....
<dataControls:RadListView x:Name="customerListView"
ItemsSource="{Binding CustomerList}"
BackgroundColor="White"
IsPullToRefreshEnabled="True">
I can replicate this in my local development environment. For whatever reason as soon as I ask it to render (set ItemsSource) something it crashes with that error..
https://slack-files.com/T06BQEKFZ-F3SHE5P7Z-a36f387da2
https://slack-files.com/T06BQEKFZ-F3RSHPD6W-6672946e91
this happens as soon as I set the ItemsSource property to something, and it tries to render a cell. If I dont set ItemsSource I can see the list view (i.e. i can pull down to refresh). Looks like a bug in the renderer code...
https://slack-files.com/T06BQEKFZ-F3RSHPD6W-6672946e91
https://slack-files.com/T06BQEKFZ-F3SHE5P7Z-a36f387da2
Thank you for contacting us! The reported issue seems to be related to a specific setting in debug build. You can try to uncheck incremental builds setting in project properties. Currently, mono has trouble loading all custom types when this setting is set. We are working to pinpoint and workaround the issue however it seems like a mono framework limitation.
We will update our documentation with troubleshooting article shortly as well as throw more meaningful exception.
Please, excuse us for the inconvenience caused.
Regards,
Tsvyatko
Telerik by Progress
I have incremental builds disabled in my Debug | iPhoneSimulator build configuration. The same exception appeared after updating controls to the current version - 2018.1.405.240
I already cleaned (manually) all bin/obj/packages folders and the issue remains:
at Telerik.XamarinForms.DataControlsRenderer.iOS.ListViewDataSource.OnDataChanged (System.Object sender, System.EventArgs eventArgs) [0x00000]
in
<50a3d3d8582c4c19be6c8f3aae71fce2>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.RaiseDataChanged (Telerik.XamarinForms.Common.Data.CollectionChange change, Telerik.XamarinForms.DataControls.ListView.ListViewDataGroup group) [0x00012]
in
<50a3d3d8582c4c19be6c8f3aae71fce2>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.RaiseDataChanged (Telerik.XamarinForms.Common.Data.CollectionChange change) [0x00000]
in
<50a3d3d8582c4c19be6c8f3aae71fce2>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.OnStatusChanged (System.Object sender, Telerik.XamarinForms.Common.Data.DataProviderStatusChangedEventArgs eventArgs) [0x0002b]
in
<50a3d3d8582c4c19be6c8f3aae71fce2>:0
at Telerik.XamarinForms.Common.Data.DataProviderBase.OnStatusChanged (Telerik.XamarinForms.Common.Data.DataProviderStatusChangedEventArgs args) [0x00038]
in
<aeb78dad1067408ca0f70679e60882f8>:0
at Telerik.XamarinForms.Common.Data.LocalDataSourceProvider.ResetStatus () [0x00009]
in
<aeb78dad1067408ca0f70679e60882f8>:0
at Telerik.XamarinForms.Common.Data.LocalDataSourceProvider.RefreshInternalView (System.Boolean resetStatus) [0x000b8]
in
<aeb78dad1067408ca0f70679e60882f8>:0
at Telerik.XamarinForms.Common.Data.LocalDataSourceProvider.OnItemsSourceChanged (System.Object newValue) [0x00016]
in
<aeb78dad1067408ca0f70679e60882f8>:0
at Telerik.XamarinForms.Common.Data.LocalDataSourceProvider.set_ItemsSource (System.Object value) [0x00010]
in
<aeb78dad1067408ca0f70679e60882f8>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.UpdateItemsSource () [0x00011]
in
<50a3d3d8582c4c19be6c8f3aae71fce2>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.OnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs eventArgs) [0x00017]
in
<50a3d3d8582c4c19be6c8f3aae71fce2>:0
at (wrapper
delegate
-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(
object
,System.ComponentModel.PropertyChangedEventArgs)
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a]
in
D:\agent\_work\1\s\Xamarin.Forms.Core\BindableObject.cs:146
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000]
in
D:\agent\_work\1\s\Xamarin.Forms.Core\Element.cs:401
at Telerik.XamarinForms.DataControls.RadListView.OnPropertyChanged (System.String propertyName) [0x00028]
in
<50a3d3d8582c4c19be6c8f3aae71fce2>:0
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00107]
in
D:\agent\_work\1\s\Xamarin.Forms.Core\BindableObject.cs:602
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b]
in
D:\agent\_work\1\s\Xamarin.Forms.Core\BindableObject.cs:399
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9]
in
D:\agent\_work\1\s\Xamarin.Forms.Core\BindingExpression.cs:172
at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e]
in
D:\agent\_work\1\s\Xamarin.Forms.Core\BindingExpression.cs:56
at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__47_0 () [0x00000]
in
D:\agent\_work\1\s\Xamarin.Forms.Core\BindingExpression.cs:557
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000]
in
/Library/Frameworks/Xamarin.iOS.framework/Versions/11.10.1.178/src/Xamarin.iOS/Foundation/NSAction.cs:125
I am having the same problem as Marek, and I am using 2018.2.516. version.
I have a MasterDetailPage as the main page, and the RadListView is inside a content page which has been set as Detail for the main MasterDetailPage.
Everything works fine the first time, but when I set MasterDetailPage.Detail to some other page and set it back to the page that has RadListView on it, it generates NullReferenceException.
The following is my stacktrace:
at Telerik.XamarinForms.DataControlsRenderer.iOS.ListViewDataSource.OnDataChanged (System.Object sender, System.EventArgs eventArgs) [0x00000] in <8f4a997bfc374486a1052675f6c6e0e8>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.RaiseDataChanged (Telerik.XamarinForms.Common.Data.CollectionChange change, Telerik.XamarinForms.DataControls.ListView.ListViewDataGroup group) [0x00012] in <8f4a997bfc374486a1052675f6c6e0e8>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.RaiseDataChanged (Telerik.XamarinForms.Common.Data.CollectionChange change) [0x00000] in <8f4a997bfc374486a1052675f6c6e0e8>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.OnStatusChanged (System.Object sender, Telerik.XamarinForms.Common.Data.DataProviderStatusChangedEventArgs eventArgs) [0x0002b] in <8f4a997bfc374486a1052675f6c6e0e8>:0
at Telerik.XamarinForms.Common.Data.DataProviderBase.OnStatusChanged (Telerik.XamarinForms.Common.Data.DataProviderStatusChangedEventArgs args) [0x00038] in <a2b7cf99c04e4c77b41c9475bb834c85>:0
at Telerik.XamarinForms.Common.Data.LocalDataSourceProvider.ResetStatus () [0x00009] in <a2b7cf99c04e4c77b41c9475bb834c85>:0
at Telerik.XamarinForms.Common.Data.LocalDataSourceProvider.RefreshInternalView (System.Boolean resetStatus) [0x000b8] in <a2b7cf99c04e4c77b41c9475bb834c85>:0
at Telerik.XamarinForms.Common.Data.LocalDataSourceProvider.OnItemsSourceChanged (System.Object newValue) [0x00016] in <a2b7cf99c04e4c77b41c9475bb834c85>:0
at Telerik.XamarinForms.Common.Data.LocalDataSourceProvider.set_ItemsSource (System.Object value) [0x00010] in <a2b7cf99c04e4c77b41c9475bb834c85>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.UpdateItemsSource () [0x00011] in <8f4a997bfc374486a1052675f6c6e0e8>:0
at Telerik.XamarinForms.DataControls.ListView.ListViewDataAdapter.OnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs eventArgs) [0x00017] in <8f4a997bfc374486a1052675f6c6e0e8>:0
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:153
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:402
at Telerik.XamarinForms.DataControls.RadListView.OnPropertyChanged (System.String propertyName) [0x00028] in <8f4a997bfc374486a1052675f6c6e0e8>:0
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00116] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:634
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:426
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00216] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:173
at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:57
at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__49_0 () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:612
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.10.1.178/src/Xamarin.iOS/Foundation/NSAction.cs:125
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.10.1.178/src/Xamarin.iOS/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName)
@Stephanos if you need a workaround for this issue here it is:
01.
public
class
MdRadListView : RadListView
02.
{
03.
protected
override
void
OnPropertyChanged(
string
propertyName =
null
)
04.
{
05.
try
06.
{
07.
base
.OnPropertyChanged(propertyName);
08.
}
09.
catch
(Exception ex)
10.
{
11.
// swallow or log if you wish
12.
}
13.
}
14.
}
Although it's a nasty hack it works. It's sad that such hacks are normal part of working with Xamarin.Forms...
We have identified this behavior and have it logged in our internal system. You can track the progress of the bug report on the following link - RadListView: [iOS] Exception when rebining ItemsSource after navigation. Actually, we are already working on the item and expect to have a fix with the service pack release which is planned for 20.06.2018. Please subscribe to the item so that you are automatically notified when the fix is applied.
Have a great rest of the week.
Regards,
Stefan Nenchev
Progress Telerik