xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

"iOS Xamarin.Forms: NSInternalInconsistencyException when scrolling TimePicker after updating to iOS 17.1.1/17.1.2" #15846

Open satish-dnv opened 6 months ago

satish-dnv commented 6 months ago

Description

Our Xamarin.Forms iOS application is experiencing crashes with a specific exception: Fatal Exception: NSInternalInconsistencyException Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread. The crashes occur when users attempt to scroll the timepicker. Notably, this issue has emerged after users updated their iOS devices to versions 17.1.1 and 17.1.2.

Despite my efforts, I haven't been able to replicate the problem on my physical device or simulator. The majority of affected users are located in the USA. We rely on Firebase Crashlytics to log these incidents. The attached screenshots are sourced from Crashlytics.

Has anyone else encountered a similar problem with Xamarin.Forms and iOS 17.1.1/17.1.2? Any insights into resolving this issue or suggestions for further troubleshooting would be greatly appreciated.

Steps to Reproduce

NA

Expected Behavior

App should not crash when scrolling the time picker.

Actual Behavior

When scrolling the time picker, app crashes.

Basic Information

Screenshots

Screenshot 2023-12-12 at 10 19 17 AM Screenshot 2023-12-12 at 10 19 30 AM
MitchBomcanhao commented 6 months ago

I've been getting similar-ish crashes across multiple app areas and iOS versions: image

these do not seem linked to the time picker (I think mine are related to listview/collectionview), but they may point to a similar underlying issue.

satish-dnv commented 6 months ago

@MitchBomcanhao Were you able to reproduce the issue in debug mode? What is the iOS version you are getting the crash? Can you please share me version details of Xamarin.forms and xamarin.iOS?

MitchBomcanhao commented 6 months ago

Sorry, almost all reports I've got are not reproducible. There was one I had a while ago where it would crash when clearing an observable collection that was linked to a ui element (and I fixed that by replacing the collection with a new blank on instead of clearing it), but were still getting multiple failures in other locations. We do have date and time pickers but nobody has reported any specific issues and the appcenter crash reports aren't detailed enough to know what is actually triggering the failures. We've been having these for a while across various xamarin forms versions (up to latest) and multiple ios versions too.

I don't have access to any of the devices you've mentioned so it might be tricky to try and reproduce it on my side, but I'm definitely interested in your specific bug report as I might be finding the same problem soon..

satish-dnv commented 6 months ago

@MitchBomcanhao Hi. Issue got resolved by managing the UI updates on main thread. Please check this link [https://github.com/xamarin/Xamarin.Forms/issues/9469]