dotMorten / MauiEx

A set of .NET MAUI controls
Apache License 2.0
224 stars 55 forks source link

IOS13 crash while changing ItemsSource property in modal page #65

Closed CrowdedFuzzball closed 4 years ago

CrowdedFuzzball commented 4 years ago

Hello!

Thanks for the excellent control. Until a certain time, there were no problems with its use, however, either after switching from PCL to .NET Standart, or after updating its version, there was a problem with iOS13.

Description

If a window with the specified component is opened through the following construction, an error occurs: await Navigation.PushModalAsync (Page);

I saw in issues that opening a window through Application.Current.MainPage = new PageWithAutoSuggestBox ... solves the problem and it really solves it.

However, the use of modal windows is fundamental in our project. Hope it it's not a hard job to fix this and this controll will be better.

Trace from release mode ================================================================= Basic Fault Address Reporting ================================================================= Memory around native instruction pointer (0x7fff51af733a):0x7fff51af732a ff ff c3 90 90 90 b8 48 01 00 02 49 89 ca 0f 05 .......H...I.... 0x7fff51af733a 73 08 48 89 c7 e9 e5 a2 ff ff c3 90 90 90 b8 53 s.H............S 0x7fff51af734a 00 00 02 49 89 ca 0f 05 73 08 48 89 c7 e9 cd a2 ...I....s.H..... 0x7fff51af735a ff ff c3 90 90 90 b8 83 01 00 02 49 89 ca 0f 05 ...........I.... ================================================================= Managed Stacktrace: ================================================================= ================================================================= 2020-03-27 12:42:23.274929+0500 Project.ios[8314:254428] Unhandled Exception: Foundation.MonoTouchException: Objective-C exception thrown. Name: NSGenericException Reason: Unable to activate constraint with anchors and because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal. Native stack trace: 0 CoreFoundation 0x00007fff23e3dcce __exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff50b3b9b2 objc_exception_throw + 48 2 Foundation 0x00007fff25ab1292 -[NSLayoutConstraint setActive:] + 0 3 ??? 0x000000011e7f3f87 0x0 + 4806623111 at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x0000b] in <6252586a35564878bf0f39c0423aa43f>:0 at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in <6252586a35564878bf0f39c0423aa43f>:0 at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr) at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_bool(intptr,intptr,bool) at UIKit.NSLayoutConstraint.set_Active (System.Boolean value) [0x0001d] in <6252586a35564878bf0f39c0423aa43f>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.UpdateSuggestionListOpenState () [0x00097] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.set_IsSuggestionListOpen (System.Boolean value) [0x00007] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.SetItems (System.Collections.Generic.IEnumerable`1[T] items, System.Func`2[T,TResult] labelFunc, System.Func`2[T,TResult] textFunc) [0x00082] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.UpdateItemsSource () [0x00024] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00167] in <20bb9947fc54459a8f36288070c8dfcf>:0 at (wrapper delegate-invoke) .invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs) at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00012] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in <34017a75c85c45aa9f9e020189ac2ac1>: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) [0x0011b] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at dotMorten.Xamarin.Forms.AutoSuggestBox.set_ItemsSource (System.Collections.IList value) [0x00000] in <20bb9947fc54459a8f36288070c8dfcf>:0 at Hub.IRNewRemoteFromDB.Manufactorer_TextChanged (dotMorten.Xamarin.Forms.AutoSuggestBox sender, dotMorten.Xamarin.Forms.AutoSuggestBoxTextChangedEventArgs e) [0x0007a] in <29d6a498503543a99aed59f231f66703>:0 at dotMorten.Xamarin.Forms.AutoSuggestBox.NativeControlTextChanged (System.String text, dotMorten.Xamarin.Forms.AutoSuggestionBoxTextChangeReason reason) [0x00027] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.AutoSuggestBox_TextChanged (System.Object sender, dotMorten.Xamarin.Forms.AutoSuggestBoxTextChangedEventArgs e) [0x0001c] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.InputText_EditingChanged (System.Object sender, System.EventArgs e) [0x00013] in <20bb9947fc54459a8f36288070c8dfcf>:0 at UIKit.UIControlEventProxy.Activated () [0x00004] in <6252586a35564878bf0f39c0423aa43f>:0 --- End of stack trace from previous location where exception was thrown --- at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_bool(intptr,intptr,bool) at UIKit.NSLayoutConstraint.set_Active (System.Boolean value) [0x0001d] in <6252586a35564878bf0f39c0423aa43f>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.UpdateSuggestionListOpenState () [0x00097] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.set_IsSuggestionListOpen (System.Boolean value) [0x00007] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.SetItems (System.Collections.Generic.IEnumerable`1[T] items, System.Func`2[T,TResult] labelFunc, System.Func`2[T,TResult] textFunc) [0x00082] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.UpdateItemsSource () [0x00024] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00167] in <20bb9947fc54459a8f36288070c8dfcf>:0 at (wrapper delegate-invoke) .invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs) at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00012] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in <34017a75c85c45aa9f9e020189ac2ac1>: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) [0x0011b] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at dotMorten.Xamarin.Forms.AutoSuggestBox.set_ItemsSource (System.Collections.IList value) [0x00000] in <20bb9947fc54459a8f36288070c8dfcf>:0 at Hub.IRNewRemoteFromDB.Manufactorer_TextChanged (dotMorten.Xamarin.Forms.AutoSuggestBox sender, dotMorten.Xamarin.Forms.AutoSuggestBoxTextChangedEventArgs e) [0x0007a] in <29d6a498503543a99aed59f231f66703>:0 at dotMorten.Xamarin.Forms.AutoSuggestBox.NativeControlTextChanged (System.String text, dotMorten.Xamarin.Forms.AutoSuggestionBoxTextChangeReason reason) [0x00027] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.AutoSuggestBox_TextChanged (System.Object sender, dotMorten.Xamarin.Forms.AutoSuggestBoxTextChangedEventArgs e) [0x0001c] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.InputText_EditingChanged (System.Object sender, System.EventArgs e) [0x00013] in <20bb9947fc54459a8f36288070c8dfcf>:0 at UIKit.UIControlEventProxy.Activated () [0x00004] in <6252586a35564878bf0f39c0423aa43f>:0 --- End of stack trace from previous location where exception was thrown --- 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 <6252586a35564878bf0f39c0423aa43f>:0 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in <6252586a35564878bf0f39c0423aa43f>:0 at Project.ios.Application.Main (System.String[] args) [0x00000] in <3c9cc13d52034738b98614696c91ec89>:0 0 CoreFoundation 0x00007fff23e3dcce __exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff50b3b9b2 objc_exception_throw + 48 2 Foundation 0x00007fff25ab1292 -[NSLayoutConstraint setActive:] + 0 3 ??? 0x000000011e7f3f87 0x0 + 4806623111 2020-03-27 12:42:23.276309+0500 Project.ios[8314:254428] Unhandled managed exception: Objective-C exception thrown. Name: NSGenericException Reason: Unable to activate constraint with anchors and because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal. Native stack trace: 0 CoreFoundation 0x00007fff23e3dcce __exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff50b3b9b2 objc_exception_throw + 48 2 Foundation 0x00007fff25ab1292 -[NSLayoutConstraint setActive:] + 0 3 ??? 0x000000011e7f3f87 0x0 + 4806623111 (Foundation.MonoTouchException) at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x0000b] in <6252586a35564878bf0f39c0423aa43f>:0 at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in <6252586a35564878bf0f39c0423aa43f>:0 at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr) at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_bool(intptr,intptr,bool) at UIKit.NSLayoutConstraint.set_Active (System.Boolean value) [0x0001d] in <6252586a35564878bf0f39c0423aa43f>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.UpdateSuggestionListOpenState () [0x00097] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.set_IsSuggestionListOpen (System.Boolean value) [0x00007] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.SetItems (System.Collections.Generic.IEnumerable`1[T] items, System.Func`2[T,TResult] labelFunc, System.Func`2[T,TResult] textFunc) [0x00082] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.UpdateItemsSource () [0x00024] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00167] in <20bb9947fc54459a8f36288070c8dfcf>:0 at (wrapper delegate-invoke) .invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs) at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00012] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in <34017a75c85c45aa9f9e020189ac2ac1>: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) [0x0011b] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at dotMorten.Xamarin.Forms.AutoSuggestBox.set_ItemsSource (System.Collections.IList value) [0x00000] in <20bb9947fc54459a8f36288070c8dfcf>:0 at Hub.IRNewRemoteFromDB.Manufactorer_TextChanged (dotMorten.Xamarin.Forms.AutoSuggestBox sender, dotMorten.Xamarin.Forms.AutoSuggestBoxTextChangedEventArgs e) [0x0007a] in <29d6a498503543a99aed59f231f66703>:0 at dotMorten.Xamarin.Forms.AutoSuggestBox.NativeControlTextChanged (System.String text, dotMorten.Xamarin.Forms.AutoSuggestionBoxTextChangeReason reason) [0x00027] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.AutoSuggestBox_TextChanged (System.Object sender, dotMorten.Xamarin.Forms.AutoSuggestBoxTextChangedEventArgs e) [0x0001c] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.InputText_EditingChanged (System.Object sender, System.EventArgs e) [0x00013] in <20bb9947fc54459a8f36288070c8dfcf>:0 at UIKit.UIControlEventProxy.Activated () [0x00004] in <6252586a35564878bf0f39c0423aa43f>:0 --- End of stack trace from previous location where exception was thrown --- at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_bool(intptr,intptr,bool) at UIKit.NSLayoutConstraint.set_Active (System.Boolean value) [0x0001d] in <6252586a35564878bf0f39c0423aa43f>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.UpdateSuggestionListOpenState () [0x00097] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.set_IsSuggestionListOpen (System.Boolean value) [0x00007] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.SetItems (System.Collections.Generic.IEnumerable`1[T] items, System.Func`2[T,TResult] labelFunc, System.Func`2[T,TResult] textFunc) [0x00082] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.UpdateItemsSource () [0x00024] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00167] in <20bb9947fc54459a8f36288070c8dfcf>:0 at (wrapper delegate-invoke) .invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs) at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00012] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in <34017a75c85c45aa9f9e020189ac2ac1>: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) [0x0011b] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in <34017a75c85c45aa9f9e020189ac2ac1>:0 at dotMorten.Xamarin.Forms.AutoSuggestBox.set_ItemsSource (System.Collections.IList value) [0x00000] in <20bb9947fc54459a8f36288070c8dfcf>:0 at Hub.IRNewRemoteFromDB.Manufactorer_TextChanged (dotMorten.Xamarin.Forms.AutoSuggestBox sender, dotMorten.Xamarin.Forms.AutoSuggestBoxTextChangedEventArgs e) [0x0007a] in <29d6a498503543a99aed59f231f66703>:0 at dotMorten.Xamarin.Forms.AutoSuggestBox.NativeControlTextChanged (System.String text, dotMorten.Xamarin.Forms.AutoSuggestionBoxTextChangeReason reason) [0x00027] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.AutoSuggestBoxRenderer.AutoSuggestBox_TextChanged (System.Object sender, dotMorten.Xamarin.Forms.AutoSuggestBoxTextChangedEventArgs e) [0x0001c] in <20bb9947fc54459a8f36288070c8dfcf>:0 at dotMorten.Xamarin.Forms.Platform.iOS.iOSAutoSuggestBox.InputText_EditingChanged (System.Object sender, System.EventArgs e) [0x00013] in <20bb9947fc54459a8f36288070c8dfcf>:0 at UIKit.UIControlEventProxy.Activated () [0x00004] in <6252586a35564878bf0f39c0423aa43f>:0 --- End of stack trace from previous location where exception was thrown --- 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 <6252586a35564878bf0f39c0423aa43f>:0 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in <6252586a35564878bf0f39c0423aa43f>:0 at Project.ios.Application.Main (System.String[] args) [0x00000] in <3c9cc13d52034738b98614696c91ec89>:0

Backtrace from ios release mode in enclosure

Steps to Reproduce

  1. Create page with AutoSuggestBox
  2. Open page with await Navigation.PushModalAsync (Page) method
  3. Enter 2 or 3 symbols in AutoSuggestBox to fire private void TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs e) event
  4. Set ItemsSource in this event
  5. Get error and app crash

Basic Information

federicojoselucia commented 4 years ago

Hi, im having the same issue with modal pages.

The following error is thrown when clicking on a search box:

"Objective-C exception thrown. Name: NSGenericException Reason: Unable to activate constraint with anchors... because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal."

dotMorten commented 4 years ago

Does either of you have a small sample app that reproduces the issue?

CrowdedFuzzball commented 4 years ago

Does either of you have a small sample app that reproduces the issue?

Sure! This is a little example in zip.

If you need something more - i will try to help you and provide all necessary information.

AutoSuggestBoxTest.zip

dotMorten commented 4 years ago

@thecashit Thank you! I can reproduce

dotMorten commented 4 years ago

OK this is SO weird. This null check throws a constraint exception:

image

dotMorten commented 4 years ago

Looks like the debugger is misleading. This is the lines that causes a crash: https://github.com/dotMorten/XamarinFormsControls/blob/7584711b9341c213bb9629e304da01989155353a/AutoSuggestBox/Platform/NativeAutoSuggestBox.iOS.cs#L196-L199

The textbox and the dropdown isn't sharing parents in a model case. Not sure how to handle this just yet. Somehow need to detect that we need to use a different RootViewController

dotMorten commented 4 years ago

@@thecashit @FedericoJoseLucia Just pushed v1.1.0 with a fix. Thank you for the reproducer. It made it a lot easier. Do note though that I had to change the vertical options to not be the default expand, but Center or Top for the dropdown to show.

CrowdedFuzzball commented 4 years ago

@dotMorten Works like a charm! Thank you!

dotMorten commented 4 years ago

You're welcome, and thank you for the sponsorship. Much appreciated! And the repro. Repros makes my life easy 😁

CrowdedFuzzball commented 4 years ago

@dotMorten Hello! Unfortunately, same problem appears again. It is likely that this is due to updating Forms or iOS on the emulator.

The archive for repro is still the same. Forms 4.6.0.800 dotMorten.AutosuggestBox 1.1.1 iOS simulator 13.5

When trying to change an ItemSource, an exception about Constraints fires and app crashes.

Could you please inspect and fix that?

Thanks

dotMorten commented 4 years ago

@thecashit Have you tried debugging the issue with source from this repo?

CrowdedFuzzball commented 4 years ago

@dotMorten

At this time only for package from NuGET

In monotouch debugger i can see following: Objective-C exception thrown. Name: NSGenericException Reason: Unable to activate constraint with anchors <NSLayoutYAxisAnchor:0x600001774e80 "UITableView:0x7fc01f355e00.top"> and <NSLayoutYAxisAnchor:0x600001775980 "UITextField:0x7fc01f2ef400.bottom"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal. Native stack trace: 0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48 2 Foundation 0x00007fff25abd6d6 -[NSLayoutConstraint setActive:] + 0 3 AutoSuggestBoxTest.iOS 0x00000001021ee929 xamarin_dyn_objc_msgSend + 217 4 ??? 0x000000010cd65f4c 0x0 + 4510342988

If we go deeper i think the problem is in the Platform/NativeAutoSuggestBox.iOS.cs in 276 line

But i didn't know if this helps or not )

CrowdedFuzzball commented 4 years ago

@dotMorten Excuse me for disturbing you. Are there any updates on this issue?

The fact is that this plugin is used on a working project and we would like to release an update with a fix, as it affected the user's work.

If this problem will be fixed shortly and you are doing it, we will wait for the update in nuget. If not, we will copy the code for ourselves and try to figure it out on our own and send you information.

In general, we need to understand what to do next as it's very important for us)

dotMorten commented 4 years ago

No I do this on my spare time for free, but family, paying job and my mental health always comes first, and I haven't had the time or energy lately to look at this. Any help, PRs etc are greatly appreciated, and is how open source should work.

CrowdedFuzzball commented 4 years ago

@dotMorten Yes, I understand how OpenSource works :) And thank you again for this excellent project.

As described above - my request was not some kind of requirement, rather a request for information.

Nevertheless, we try to compile your project with the latest Xamarin.Forms and found that your plugin works fine, that is, in fact, all that is required to replace: From: <PackageReference Include = "Xamarin.Forms" Version = "3.1.0.583944" / >
To: . In: dotMorten.Xamarin.Forms.AutoSuggestBox It is likely that something has been fixed directly in Xamarin.Forms.

I didn’t think that in this case PR is required, since in any case it is required to recompile the plugin. I advise you to update the version of XF in the repository and then this problem should be solved. Maybe a lot of others, who knows

dotMorten commented 4 years ago

There's no need to recompile. You can select a newer version of forms to use. 3.1 is merely a minimum