我有 Xamarin.Forms 应用程序,它在 Android 上运行良好,但在尝试在 iOS 上测试它时,我面临运行时异常。Stacktrace 在下面提到。
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) /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:161
OrderedDictionary`2[TKey,TValue].get_Item (System.Int32 index) D:\a\1\s\Xamarin.Forms.Core\OrderedDictionary.cs:100
TemplatedItemsList`2[TView,TItem].GetGroup (System.Int32 index) D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:569
ITemplatedItemsList<TItem>.GetGroup (System.Int32 index) D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:574
ListViewRenderer+UnevenListViewDataSource.GetEstimatedRowHeight (UIKit.UITableView table) D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:799
ListViewRenderer+UnevenListViewDataSource.UpdateEstimatedRowHeight (UIKit.UITableView tableView) D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:830
ListViewRenderer+ListViewDataSource.DetermineEstimatedRowHeight () D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:1281
FormsUITableViewController.ViewWillLayoutSubviews () D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:1609
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:86
UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:65
Application.Main (System.String[] args) ...../[ProjectName].iOS/Main.cs:20
我在用
Xamarin.Forms 版本 4.5.0.617 Xamarin.iOS 版本 13.16.0.13
更新
Main.cs: 20 UIApplication.Main(args, null, "AppDelegate");