Skip to content

System.ArgumentOutOfRangeException #39

@Mustafa-ah

Description

@Mustafa-ah

Steps:
1- Install-Package Naxam.TopTabbedPage.Forms
2-create page with binding source

<?xml version="1.0" encoding="utf-8"?>
    <forms:TopTabbedPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="TestTabs.MainPage"
    xmlns:views="clr-namespace:TestTabs"
    xmlns:forms="clr-namespace:Naxam.Controls.Forms;assembly=Naxam.TopTabbedPage.Forms"
    BarTextColor="#00b9e1"
    BarIndicatorColor="#00b9e1"
    BarBackgroundColor="#ffffff"
    ItemsSource="{Binding DashboardChildModels}"
    Title="MyRide">
        <forms:TopTabbedPage.ItemTemplate>
        <DataTemplate>
            <views:ChildPage Title="title"/>
        </DataTemplate>
    </forms:TopTabbedPage.ItemTemplate>
</forms:TopTabbedPage>

3- leave the collection empty

public class DashViewModel
    {
        public DashViewModel()
        {
            DashboardChildModels = new ObservableCollection<ChildPage>();
            
        }

        private ObservableCollection<ChildPage> _dashboardChildModels;
        public ObservableCollection<ChildPage> DashboardChildModels
        {
            get
            {
               
                return _dashboardChildModels;
            }
            set { _dashboardChildModels = value; }
        }

    }

Expected behavior :
App run and display no tabs

Actual behavior :
App crash

Exception message :
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
at System.Array.InternalArray__get_Item[T] (System.Int32 index) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System/Array.cs:190
at at (wrapper managed-to-managed) UIKit.UIViewController[].System.Collections.Generic.IList`1.get_Item(int)
at Naxam.Controls.Platform.iOS.TopTabbedRenderer.ViewDidLoad () [0x00141] in <1f6b2b7c8f6c4ec4b46e787d64141cd6>:0
at at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr)
at UIKit.UIViewController.get_View () [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIViewController.g.cs:3171
at Naxam.Controls.Platform.iOS.TopTabbedRenderer.get_NativeView () [0x00000] in <1f6b2b7c8f6c4ec4b46e787d64141cd6>:0
at Naxam.Controls.Platform.iOS.TopTabbedRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00059] in <1f6b2b7c8f6c4ec4b46e787d64141cd6>:0
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in :0
at Xamarin.Forms.Platform.iOS.Platform.AddChild (Xamarin.Forms.VisualElement view) [0x00027] in :0
at Xamarin.Forms.Platform.iOS.Platform.WillAppear () [0x00043] in :0
at Xamarin.Forms.Platform.iOS.PlatformRenderer.ViewWillAppear (System.Boolean animated) [0x00016] in :0
at at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend(intptr,intptr)
at UIKit.UIWindow.MakeKeyAndVisible () [0x0000d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIWindow.g.cs:281
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.SetMainPage () [0x0000c] in :0
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.FinishedLaunching (UIKit.UIApplication uiApplication, Foundation.NSDictionary launchOptions) [0x00030] in :0
at TestTabs.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00019] in /Users/Mustafa/Projects/TestTabs/TestTabs.iOS/AppDelegate.cs:29
at 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 /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at TestTabs.iOS.Application.Main (System.String[] args) [0x00001] in /Users/Mustafa/Projects/TestTabs/TestTabs.iOS/Main.cs:17

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions