Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabbed page in .Net Maui not working on Android #10504

Closed
ThomasCarltonInPerson opened this issue Oct 5, 2022 · 7 comments
Closed

Tabbed page in .Net Maui not working on Android #10504

ThomasCarltonInPerson opened this issue Oct 5, 2022 · 7 comments
Labels
area-controls-tabbedpage TabbedPage platform/android 🤖 s/needs-info Issue needs more info from the author s/needs-repro Attach a solution or code which reproduces the issue t/bug Something isn't working

Comments

@ThomasCarltonInPerson
Copy link

I have a tabbed page in .Net Maui as follows :

	<?xml version="1.0" encoding="utf-8" ?>
	<TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
				 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
				 x:Class="MyApp.Pages.SomeClass"
				 xmlns:Controls="clr-namespace:MyApp.Resources.Controls"
				 xmlns:local="clr-namespace:MyApp.Pages"
				 Title="Some title">
				   
		<local:Page1 />
		<local:Page2 />
		<local:Page3 />

	</TabbedPage>

The pages are more or less the same :

	<?xml version="1.0" encoding="utf-8" ?>
	<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
				 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
				 x:Class="MyApp.Pages.Page1"
				 xmlns:Controls="clr-namespace:MyApp.Resources.Controls"                          
				 xmlns:VerticalStackLayout="clr-namespace:MyApp.Resources.Controls"      
				 Title="Vente">


		<VerticalStackLayout>
			<Label Text="Page 1"/>
		</VerticalStackLayout>       
	</ContentPage>

C# code :

	public partial class Page1 : ContentPage
	{    
		public Page1()
		{
			InitializeComponent();        
		}
	}

The tabbed page works properly on windows :

enter image description here

However on physical android device, I'm getting the following exception when opening my tabbed page. None of these pages have a C# stuff. They are 100% empty.

0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception	C#
0x1A in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5	C#
0x23 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:353,26	C#
0xEE in Microsoft.Maui.Controls.Handlers.TabbedPageManager.SetTabLayout at D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\TabbedPageManager.cs:240,5	C#
0x1BD in Microsoft.Maui.Controls.Handlers.TabbedPageManager.SetElement at D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\TabbedPageManager.cs:162,5	C#
0x20 in Microsoft.Maui.Controls.TabbedPage.CreatePlatformView at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\TabbedPage\TabbedPage.Android.cs:23,4	C#
0x10 in Microsoft.Maui.Controls.TabbedPage.OnCreatePlatformView at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\TabbedPage\TabbedPage.Android.cs:30,5	C#
0x15 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.ITabbedView,Android.Views.View>.OnCreatePlatformView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:72,4	C#
0x1 in Microsoft.Maui.Handlers.ViewHandler.OnCreatePlatformElement at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:119,4	C#
0x1 in Microsoft.Maui.Handlers.ElementHandler.CreatePlatformElement at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:96,4	C#
0x49 in Microsoft.Maui.Handlers.ElementHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:52,4	C#
0x2 in Microsoft.Maui.Handlers.ViewHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:125,4	C#
0x2 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.ITabbedView,Android.Views.View>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:53,4	C#
0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.ITabbedView,Android.Views.View>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
0x65 in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:64,6	C#
0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:20,11	C#
0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:301,5	C#
0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
0x2 in Microsoft.Maui.Platform.ViewExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ViewExtensions.cs:44,4	C#
0xAA in Microsoft.Maui.Controls.Platform.Compatibility.ShellContentFragment.OnCreateView at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellContentFragment.cs:145,4	C#
0x24 in AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ at C:\a\_work\3\s\generated\androidx.fragment.fragment\obj\Release\net6.0-android\generated\src\AndroidX.Fragment.App.Fragment.cs:1999,4	C#
0xD in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:352,5	C#

Does anyone know if .Net Maui tabbed pages work on Android please ?

Thanks

@PureWeen PureWeen added platform/android 🤖 area-controls-tabbedpage TabbedPage s/needs-info Issue needs more info from the author labels Oct 5, 2022
@ghost
Copy link

ghost commented Oct 5, 2022

Hi @ThomasCarltonInPerson. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@PureWeen PureWeen added the s/needs-repro Attach a solution or code which reproduces the issue label Oct 5, 2022
@ghost
Copy link

ghost commented Oct 5, 2022

Hi @ThomasCarltonInPerson. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@PureWeen
Copy link
Member

PureWeen commented Oct 5, 2022

@ThomasCarltonInPerson can you please use the template as well? Without a version that makes this even harder to track down

@mattleibow
Copy link
Member

Duplicate of #6389

This is because Shell does not support mixing non-Shell pages.

@mattleibow mattleibow closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2022
@ThomasCarltonInPerson
Copy link
Author

Duplicate of #6389

This is because Shell does not support mixing non-Shell pages.

Thanks for your comment. Then how to "disable" shell please ?

@mattleibow
Copy link
Member

Just don't use the AppShell.xaml.

Think of Shell as a really fancy navigation page.

If you want to use Shell and tabs, you can make use of shell tabs: https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/tabs

@ThomasCarltonInPerson
Copy link
Author

I'm sorry. I don't get you. What do you mean by don't use the AppShell.xaml ? Do you mean removing the file entirely from the projet ? (deleting it for example).

Then how to handle the application initialization :

	public partial class App : Application
	{
		public static AppShell ApplicationShell;

		public App()
		{
			InitializeComponent();

			App.ApplicationShell = new AppShell();
			MainPage = ApplicationShell;
		}
	}

I'm sorry if my questions seem too basic but I'm an entire beginer in .Net Maui.

Thanks

@ghost ghost locked as resolved and limited conversation to collaborators Nov 4, 2022
@samhouts samhouts added the t/bug Something isn't working label Jul 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-tabbedpage TabbedPage platform/android 🤖 s/needs-info Issue needs more info from the author s/needs-repro Attach a solution or code which reproduces the issue t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants