NAXAM / toptabbedpage-xamarin-forms

TopTabbedPage - A Xamarin.Forms page for showing tabs at top on iOS
Apache License 2.0
81 stars 24 forks source link

System.NullReferenceException is thrown when tab is pressed #18

Closed ahmedelsyaed closed 5 years ago

ahmedelsyaed commented 6 years ago

using xamarin forms 3.2.0.839982 with prism 7.0.0.396 & debug using IOS emulator 11.2

on selecting any tab a System.NullReferenceException is thrown

In app.cs await NavigationService.NavigateAsync(new System.Uri("/MainPage?SelectedTab=Page1",System.UriKind.Absolute));

Main Page

`<forms:TopTabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:forms="clr-namespace:Naxam.Controls.Forms;assembly=Naxam.TopTabbedPage.Forms"
             x:Class="TopTab2.Views.MainPage"
             xmlns:myPage="clr-namespace:TopTab2.Views"
             Title="{Binding Title}">
    <myPage:Page1 Title="page"/>
    <myPage:Page2 Title="page2"/>
    <myPage:Page3 Title="page3"/>
    <myPage:Page4 Title="page4"/>
    <myPage:Page5 Title="page5"/>
    <myPage:Page6 Title="page6"/>
    <myPage:Page7 Title="page7"/>

</forms:TopTabbedPage>`

the stack trace

2018-10-01 16:14:04.254 TopTab2.iOS[12667:155266] Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at Naxam.Controls.Platform.iOS.TopTabbedRenderer.UpdateToolbarItems (System.Int32 selectedIndex) [0x00029] in <28e49720a6204d1cb64ee7fbc65c2111>:0 at Naxam.Controls.Platform.iOS.TopTabbedRenderer.MoveToByIndex (System.Int32 selectedIndex, System.Boolean forced) [0x0004d] in <28e49720a6204d1cb64ee7fbc65c2111>:0 at Naxam.Controls.Platform.iOS.TopTabbedRenderer.HandleTabsSelectionChanged (System.Object sender, Naxam.Controls.Platform.iOS.TabsSelectionChangedEventArgs e) [0x0000c] in <28e49720a6204d1cb64ee7fbc65c2111>:0 at Naxam.Controls.Platform.iOS.TabsView.DidChangeSelectedIndex (MaterialControls.MDTabBar tabBar, System.nuint selectedIndex) [0x00012] in <28e49720a6204d1cb64ee7fbc65c2111>:0 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/11.14.0.14/src/Xamarin.iOS/UIKit/UIApplication.cs:79 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.14.0.14/src/Xamarin.iOS/UIKit/UIApplication.cs:63 at TopTab2.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\Ahmed\Documents\Visual Studio 2017\Projects\TopTab2\TopTab2.iOS\Main.cs:17 2018-10-01 16:14:04.256 TopTab2.iOS[12667:155266] Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException) at Naxam.Controls.Platform.iOS.TopTabbedRenderer.UpdateToolbarItems (System.Int32 selectedIndex) [0x00029] in <28e49720a6204d1cb64ee7fbc65c2111>:0 at Naxam.Controls.Platform.iOS.TopTabbedRenderer.MoveToByIndex (System.Int32 selectedIndex, System.Boolean forced) [0x0004d] in <28e49720a6204d1cb64ee7fbc65c2111>:0 at Naxam.Controls.Platform.iOS.TopTabbedRenderer.HandleTabsSelectionChanged (System.Object sender, Naxam.Controls.Platform.iOS.TabsSelectionChangedEventArgs e) [0x0000c] in <28e49720a6204d1cb64ee7fbc65c2111>:0 at Naxam.Controls.Platform.iOS.TabsView.DidChangeSelectedIndex (MaterialControls.MDTabBar tabBar, System.nuint selectedIndex) [0x00012] in <28e49720a6204d1cb64ee7fbc65c2111>:0 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/11.14.0.14/src/Xamarin.iOS/UIKit/UIApplication.cs:79 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.14.0.14/src/Xamarin.iOS/UIKit/UIApplication.cs:63 at TopTab2.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\Ahmed\Documents\Visual Studio 2017\Projects\TopTab2\TopTab2.iOS\Main.cs:17 2018-10-01 16:14:04.256 TopTab2.iOS[12667:155266] critical: Stacktrace:

2018-10-01 16:14:04.257 TopTab2.iOS[12667:155266] critical: Native stacktrace: 2018-10-01 16:14:04.261 TopTab2.iOS[12667:155266] critical: 0 TopTab2.iOS 0x000000010de1ba74 mono_handle_native_crash + 244 2018-10-01 16:14:04.261 TopTab2.iOS[12667:155266] critical: 1 libsystem_platform.dylib 0x0000000114ca4f5a _sigtramp + 26 2018-10-01 16:14:04.262 TopTab2.iOS[12667:155266] critical: 2 ??? 0x000000010e30d08a 0x0 + 4533047434 2018-10-01 16:14:04.262 TopTab2.iOS[12667:155266] critical: 3 libsystem_c.dylib 0x00000001149390eb abort + 127 2018-10-01 16:14:04.262 TopTab2.iOS[12667:155266] critical: 4 TopTab2.iOS 0x000000010e03533f xamarin_unhandled_exception_handler + 47 2018-10-01 16:14:04.262 TopTab2.iOS[12667:155266] critical: 5 TopTab2.iOS 0x000000010deb91fe mono_invoke_unhandled_exception_hook + 158 2018-10-01 16:14:04.263 TopTab2.iOS[12667:155266] critical: 6 TopTab2.iOS 0x000000010de1b420 mono_handle_exception_int ernal + 6240 2018-10-01 16:14:04.263 TopTab2.iOS[12667:155266] critical: 7 TopTab2.iOS 0x000000010de19bb9 mono_handle_exception + 25 2018-10-01 16:14:04.263 TopTab2.iOS[12667:155266] critical: 8 TopTab2.iOS 0x000000010dd98bb9 handle_signal_exception + 57 2018-10-01 16:14:04.264 TopTab2.iOS[12667:155266] critical: 9 ??? 0x00007ffee1f05eb8 0x0 + 140732689047224 2018-10-01 16:14:04.266 TopTab2.iOS[12667:155266] critical:

Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

tuyen-vuduc commented 5 years ago

Plz give a sample source code to check out.