Open chrisjcoan opened 6 years ago
There is Prism also Try to remove bindings one by one to find out which binding the cause of error and then check this binding
I've tried removing the bindings and the app still crashes.
If I change the FlexLayout to a StackLayout, everything works fine. It's something to do with trying to set the WidthRequest OnChildPropertyChanged in the FlexLayout.cs when the view is being destroyed.
OK...it seems to be when the FlowListView is a child of a FlexLayout that the issue occurs. The issue is iOS specific and I can replicate it for both release and debug builds.
My current workaround is to wrap my FlowListView with a StackLayout so that the StackLayout is the child of the FlexLayout. This now works and the app no longer crashes.
Exception
System.Exception: Cannot destroy App.Views.Page. ---> System.NullReferenceException: Object reference not set to an instance of an object at Xamarin.Forms.FlexLayout.OnChildPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00052] in D:\a\1\s\Xamarin.Forms.Core\FlexLayout.cs:347 at (wrapper delegate-invoke).invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:150
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:370
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) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:623
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:417
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00225] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:173
at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78
at Xamarin.Forms.Binding.Apply (System.Object context, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty tar
getProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:130
at Xamarin.Forms.BindableObject.ApplyBindings (System.Boolean skipBindingContext, System.Boolean fromBindingContextChanged) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:448
at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) [0x0005a] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:135
at Xamarin.Forms.Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:504
at Xamarin.Forms.Element.b78_0 (Xamarin.Forms.BindableObject child, System.Object bc) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:324
at Xamarin.Forms.BindableObjectExtensions.PropagateBindingContext[T] (Xamarin.Forms.BindableObject self, System.Collections.Generic.IListb__78_0 (Xamarin.Forms.BindableObject child, System.Object bc) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:324
at Xamarin.Forms.BindableObjectExtensions.PropagateBindingContext[T] (Xamarin.Forms.BindableObject self, System.Collections.Generic.IListb 78_0 (Xamarin.Forms.BindableObject child, System.Object bc) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:324
at Xamarin.Forms.BindableObjectExtensions.PropagateBindingContext[T]
(Xamarin.Forms.BindableObject self, System.Collections.Generic.IListd__69.MoveNext () [0x00118] in D:\a\1\s\Xamarin.Forms.Core\NavigationPage.cs:309
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iO
The app has been terminated.
1[T] children, System.Action
2[T1,T2] setChildBindingCo ntext) [0x0002c] in <81ae0eb290e24f558e192928e3e37a57>:0 at Xamarin.Forms.Element.OnBindingContextChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:322 at Xamarin.Forms.View.OnBindingContextChanged () [0x0000c] in D:\a\1\s\Xamarin.Forms.Core\View.cs:158 at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) [0x00062] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:136 at Xamarin.Forms.Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:504 at Xamarin.Forms.Element.1[T] children, System.Action
2[T1,T2] setChildBindingContext) [0x0002c] in <81ae0eb 290e24f558e192928e3e37a57>:0 at Xamarin.Forms.Element.OnBindingContextChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:322 at Xamarin.Forms.View.OnBindingContextChanged () [0x0000c] in D:\a\1\s\Xamarin.Forms.Core\View.cs:158 at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) [0x00062] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:136 at Xamarin.Forms.Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:504 at Xamarin.Forms.TemplatedPage.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00008] in D:\a\1\s\Xamarin.Forms.Core\TemplatedPage.cs:35 at Xamarin.Forms.Element.1[T] children, System.Action
2[T1,T2] setChildBindingContext) [0x0002c] in <81ae0eb290e24f558e192928e3e37a57>:0 at Xamarin.Forms.Element.OnBindingContextChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:322 at Xamarin.Forms.Page.OnBindingContextChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:214 at Xamarin.Forms.ContentPage.OnBindingContextChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\ContentPage.cs:16 at Xamarin.Forms.BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:468 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) [0x00120] i n D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:625 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:417 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0003d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:573 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:99 at Xamarin.Forms.BindableObject.set_BindingContext (System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:25 at Prism.Common.PageUtilities.DestroyPage (Xamarin.Forms.Page page) [0x0003c] in D:\a\1\s\Source\Xamarin\Prism.Forms\Common\PageUtilities.cs:46 --- End of inner exception stack trace --- at Prism.Common.PageUtilities.DestroyPage (Xamarin.Forms.Page page) [0x00046] in D:\a\1\s\Source\Xamarin\Prism.Forms\Common\PageUtilities.cs:50 at Prism.Common.PageUtilities.HandleSystemGoBack (Xamarin.Forms.Page previousPage, Xamarin.Forms.Page currentPage) [0x0002f] in D:\a\1\s\Source\Xamarin\Prism.Forms\Common\PageUtilities.cs:225 at Prism.Behaviors.NavigationPageSystemGoBackBehavior.NavigationPage_Popped (System.Object sender, Xamarin.Forms.NavigationEventArgs e) [0x00008] in D:\a\1\s\Source\Xamarin\Prism.Forms\Behaviors\NavigationPageSystemGoBackBehavior.cs:25 at Xamarin.Forms.NavigationPage+XAML