Skip to content

NullReferenceException: NativeCode.Mobile.AppCompat.FormsAppCompat.Adapters.ActionBarAdapter.SelectTab #9

Closed
@chrisriesgo

Description

@chrisriesgo

I receive this Null Ref exception in my app on a TabbedPage.

Steps:

  1. Activity inherits from AppCompatFormsApplicationActivity.
  2. LoadApplication with NavigationPage that wraps a TabbedPage [app.MainPage = new NavigationPage(new TabbedPage())]
  3. In constructor of TabbedPage, add n Children [Children.Add(page)]
  4. After OnAppearing, attempt to clear Children [Children.Clear()]
  5. Crash
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object
[MonoDroid] at NativeCode.Mobile.AppCompat.FormsAppCompat.Adapters.ActionBarAdapter.SelectTab (Android.App.ActionBar/Tab) <IL 0x0000c, 0x0008c>
[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.CurrentTabbedPageOnPropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0002f, 0x0017f>
[MonoDroid] at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0004c, 0x000c3>
[MonoDroid] at Xamarin.Forms.BindableObject.OnPropertyChanged (string) <IL 0x00012, 0x000d7>
[MonoDroid] at Xamarin.Forms.MultiPage`1<Xamarin.Forms.Page>.OnPropertyChanged (string) <0x00477>
[MonoDroid] at Xamarin.Forms.MultiPage`1<Xamarin.Forms.Page>.set_CurrentPage (Xamarin.Forms.Page) <0x00107>
[MonoDroid] at Xamarin.Forms.MultiPage`1<Xamarin.Forms.Page>.OnChildrenChanged (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs) <0x0053b>
[MonoDroid] at (wrapper delegate-invoke) <Module>.invoke_void_object_NotifyCollectionChangedEventArgs (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs) <IL 0x0004c, 0x000c3>
[MonoDroid] at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs) <0x000df>
[MonoDroid] at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction,object,int) <0x000af>
[MonoDroid] at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.RemoveItem (int) <0x00143>
[MonoDroid] at System.Collections.ObjectModel.Collection`1<Xamarin.Forms.Element>.RemoveAt (int) <0x001cf>
[MonoDroid] at Xamarin.Forms.ObservableWrapper`2<Xamarin.Forms.Element, Xamarin.Forms.Page>.RemoveAt (int) <0x00197>
[MonoDroid] at Java.Lang.Thread/RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
[MonoDroid] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Java.Lang.IRunnable.cs:71
[MonoDroid] at (wrapper dynamic-method) object.0c94e7b2-d7c6-4be0-84a8-ff5642ff1785 (intptr,intptr) <IL 0x00011, 0x0003b>
06:50:53.3260 - [FATAL] (1) UncaughtExceptionHandler - System.NullReferenceException: Object reference not set to an instance of an object
at NativeCode.Mobile.AppCompat.FormsAppCompat.Adapters.ActionBarAdapter.SelectTab (Android.App.ActionBar/Tab) <IL 0x0000c, 0x0008c>
at Xamarin.Forms.Platform.Android.Platform.CurrentTabbedPageOnPropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0002f, 0x0017f>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0004c, 0x000c3>
at Xamarin.Forms.BindableObject.OnPropertyChanged (string) <IL 0x00012, 0x000d7>
at Xamarin.Forms.MultiPage`1<Xamarin.Forms.Page>.OnPropertyChanged (string) <0x00477>
at Xamarin.Forms.MultiPage`1<Xamarin.Forms.Page>.set_CurrentPage (Xamarin.Forms.Page) <0x00107>
at Xamarin.Forms.MultiPage`1<Xamarin.Forms.Page>.OnChildrenChanged (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs) <0x0053b>
at (wrapper delegate-invoke) <Module>.invoke_void_object_NotifyCollectionChangedEventArgs (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs) <IL 0x0004c, 0x000c3>
at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs) <0x000df>
at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction,object,int) <0x000af>
at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.RemoveItem (int) <0x00143>
at System.Collections.ObjectModel.Collection`1<Xamarin.Forms.Element>.RemoveAt (int) <0x001cf>
at Xamarin.Forms.ObservableWrapper`2<Xamarin.Forms.Element, Xamarin.Forms.Page>.RemoveAt (int) <0x00197>
at Java.Lang.Thread/RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Java.Lang.IRunnable.cs:71
at (wrapper dynamic-method) object.0c94e7b2-d7c6-4be0-84a8-ff5642ff1785 (intptr,intptr) <IL 0x00011, 0x0003b>
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
[AndroidRuntime] Shutting down VM

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions