Hi,
I've implemented the Messaging Center in a really simple way, and it works the first time it's used. However, if I then back out of the app (using the hardware button in Android), and then re-open the app, it fails at the point of attempting to send the message for the second time. The error message makes no sense and I don't get much from Google. Is there something I have to manage if the app is paused/put into the background, and then is re-opened?
I've already tried re-subscribing to this particular message inside OnAppearing but that made no difference.
The error:
{System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.NavigationProxy.set_Inner (INavigation value) [0x00000] in <filename unknown>:0
at Xamarin.Forms.VisualElement.OnParentSet () [0x00000] in <filename unknown>:0
at Xamarin.Forms.Element.set_Parent (Xamarin.Forms.Element value) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element child) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Layout.OnInternalAdded (Xamarin.Forms.View view) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0
at (wrapper delegate-invoke) <Module>:invoke_void_object_NotifyCollectionChangedEventArgs (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
at (wrapper delegate-invoke) <Module>:invoke_void_object_NotifyCollectionChangedEventArgs (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0
at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].InsertItem (Int32 index, Xamarin.Forms.Element item) [0x00000] in <filename unknown>:0
at System.Collections.ObjectModel.Collection`1[Xamarin.Forms.Element].Add (Xamarin.Forms.Element item) [0x00000] in <filename unknown>:0
at Xamarin.Forms.ObservableWrapper`2[Xamarin.Forms.Element,Xamarin.Forms.View].Add (Xamarin.Forms.View item) [0x00000] in <filename unknown>:0
at Essence.App.Views.Index.DisplayIndex () [0x00058] in xxx\Views\Index.cs:57
at Essence.App.Views.Index.<SubscribeToLoginResultMessage>b__3 (xxx.IndexViewModel arg) [0x00039] in xxx\Views\Index.cs:78
at Xamarin.Forms.MessagingCenter+<>c__DisplayClass4`1[xxxx.IndexViewModel].<Subscribe>b__3 (System.Object sender, System.Object args) [0x00000] in <filename unknown>:0
at Xamarin.Forms.MessagingCenter.InnerSend (System.String message, System.Type senderType, System.Type argType, System.Object sender, System.Object args) [0x00000] in <filename unknown>:0
at Xamarin.Forms.MessagingCenter.Send[IndexViewModel] (Essence.App.ViewModels.IndexViewModel sender, System.String message) [0x00000] in <filename unknown>:0
at Essence.App.Views.Login+<btnLogin_Clicked>d__b.MoveNext () [0x00405] in d:\xxx\Views\Login.cs:137 }
Thanks