作者:手机用户2602939883 | 来源:互联网 | 2023-09-15 09:45
This happens quite often when I close some modal pages, when running on my iPad Pro 12.9" with iOS 14:
1 2 3 4 5 6 7 8 9 10 11 12
| SIGABRT: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
List`1[T].get_Item (System.Int32 index)
Application+NavigationImpl.OnPopModal (System.Boolean animated)
ModalWrapper.DidDismiss (UIKit.UIPresentationController presentationController)
AsyncMethodBuilderCore&#043;<>c.b__7_0 (System.Object state)
NSAsyncSynchronizationContextDispatcher.Apply ()
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate)
UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName)
Application.Main (System.String[] args)
|
Xamarin.Forms 4.8.0.1560.
该提问来源于开源项目:xamarin/Xamarin.Forms
After 3 days of testing, we were successful in isolating an iOS app crash problem and concluded the problem is the same as other problems described in this thread. The combination of the iOS 14.0 SDK, a CollectionView control, and a Navigation.PopAsync call from a page in the Master-Detail Page’s Detail page queue triggers the problem. We tested both ObservableCollection<> and List<> data structures for the ItemsSource binding. In our case, test results remained the same for both data structures. Please note, the iOS app has not exhibited similar problems on any page serving as a root detail page—needless to say, PopAsync is never called on root pages, one root instance reference is replaced with another instance reference. Additionally, this only impacts an iOS app, not its Android app sibling.
Prior to the introduction of the CollectionView control, we became big fans of the FlowListView control, created by Daniel Luberda. FlowListView has been an extremely useful wrapper for the now outdated ListView control, introducing logic to configure multiple columns. We began replacing FlowListView instances with CollectionView instances throughout our suite of mobile apps a year ago. Fortunately, we are less than halfway through the effort, replacing upwards of 100 of a couple hundred list controls. Simply reverting to the FlowListView control on the impacted page has served as an effective workaround.
The mobile app experiencing the problem is one of our oldest mobile apps. When factoring in that known fact, our current best guess as to root cause is outdated csprj files in the shared, Android, and iOS projects. A csprj config setting, or a combination of multiple settings, could be root cause. This could explain why MS Engineers have struggled to repro the problem. The csprj files in our impacted mobile app may have been created in VS2017 or possibly VS2015. At some point in the near future, we will recreate the csprj files to conform to the latest VS2019 standards and reintroduce dependent project and NuGet package references. Unfortunately, we estimate another 2-3 days of effort to update the csprj files and execute a couple hundred end-to-end regression tests via MS App Center Cloud Test Service.