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

[Android] Pushing TabbedPage from Shell-based ContentPage causes NRE. #7615

Open
maxkoshevoi opened this issue May 30, 2022 · 21 comments
Open
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@maxkoshevoi
Copy link
Contributor

maxkoshevoi commented May 30, 2022

Description

#6390 added a user-friendly exception messages when using TabbedPags, however, I'm getting

Microsoft.Maui.Platform.ToPlatformException: 'Microsoft.Maui.Handlers.TabbedViewHandler found for AddTimetablePage is incompatible'

image

Steps to Reproduce

Open a TabbedPage from a ContentPage on Android

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12

Did you find any workaround?

No response

Relevant log output

No response

@maxkoshevoi maxkoshevoi added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels May 30, 2022
@drasticactions
Copy link
Contributor

That exception appears when you're using a Tabbed page from within a shell page

image

If you use that, it will show the exceptions that were added in that PR. What you're doing is pushing to a Tabbed page from a ContentPage that is referenced in Shell, which doesn't use that code path.

@drasticactions drasticactions changed the title Incorrect exception message when using TabbedPage in Shell [Android] Pushing TabbedPage from Shell-based ContentPage causes Platform Handler exception. May 30, 2022
@drasticactions
Copy link
Contributor

I've updated the title to reflect the issue. On Windows and iOS it does push a new tabbed page. On Android, it blows up with the handler exception.

@drasticactions drasticactions added area-controls-shell Shell Navigation, Routes, Tabs, Flyout s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels May 30, 2022
@maxkoshevoi
Copy link
Contributor Author

Oh, so TabbedPage is actually supported in this scenario? That's great! I thought, I'll need to wait till November (.NET 7) to be able to port my app

@maxkoshevoi
Copy link
Contributor Author

@drasticactions Could you also add a area/TabbedPage and platform/android 🤖 tags?

@polygonsheep
Copy link

https://docs.microsoft.com/en-us/dotnet/maui/user-interface/pages/tabbedpage

From the Maui documentation :
"Warning

TabbedPage is incompatible with .NET MAUI Shell apps, and an exception will be thrown if you attempt to use TabbedPage in a Shell app."

@maxkoshevoi maxkoshevoi changed the title [Android] Pushing TabbedPage from Shell-based ContentPage causes Platform Handler exception. [Android] Pushing TabbedPage from Shell-based ContentPage causes NRE. Jul 14, 2022
@maxkoshevoi
Copy link
Contributor Author

maxkoshevoi commented Jul 14, 2022

Every service release brings something new for this issue 😄

  • So initially (in 6.0.300) there was a Platform Handler exception when opening the page
  • In 6.0.400 page was actually opining fine, but header with tabbs was missing

Xamarin:
image

MAUI 6.0.400:
image

  • And now (in 6.0.408) page fails to open again, but this time with NRE:

image

if (layoutContent.LayoutParameters is ViewGroup.MarginLayoutParams cl)

@PureWeen
Copy link
Member

Duplicate of #6389

@PureWeen PureWeen marked this as a duplicate of #6389 Oct 18, 2022
@maxkoshevoi
Copy link
Contributor Author

maxkoshevoi commented Oct 18, 2022

Duplicate of #6389

I thought that issus was about displaying TabbedPage as one of Shell's tabbs, not about opening a TabbedPage from within Shell application (see first comment in this issue)

In another words, I'm not using TabbedPage as ShellContent, I'm opening it as a new Modal page

@PureWeen
Copy link
Member

Duplicate of #6389

I thought that issus was about displaying TabbedPage as one of Shell's tabbs, not about opening a TabbedPage from within Shell application (see first comment in this issue)

In another words, I'm not using TabbedPage as ShellContent, I'm opening it as a new Modal page

Can you attach a repro?

I tested pushing a TabbedPage modally and it's working fine for me

image

I also tested with URI routing

image

@PureWeen PureWeen added s/needs-info Issue needs more info from the author and removed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Nov 18, 2022
@ghost ghost added the s/no-recent-activity Issue has had no recent activity label Nov 22, 2022
@maxkoshevoi
Copy link
Contributor Author

Oh, I thought I've provided a repro, sorry.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author s/no-recent-activity Issue has had no recent activity labels Nov 24, 2022
@PureWeen
Copy link
Member

PureWeen commented Nov 30, 2022

@maxkoshevoi I think I'm doing a bad job following this thread

In your comment here you said

In another words, I'm not using TabbedPage as ShellContent, I'm opening it as a new Modal page

So, I provided an example of how TabbedPage works fine as a new Modal page here
#7615 (comment)

Minimal repro was provided here #7615 (comment) (not mine, so not sure if it works)

Isn't using TabbedPage modally it's using it a ShellContent and we have a bug for that logged here.

And here's more complete one:

From that line of code it looks like TabbedPage isn't being pushed Modally

So, I'm unclear if this issue is related to Modal or if it's related to using TabbedPage inside Shell

If it's the former, then can you attach a repro where it's not working modally?
If it's the latter, then that makes this a duplicate issue of #6389

Marking things as duplicates just helps us organize and prioritize so I'd like to understand if this is a different bug or a duplicate of #6389

@PureWeen PureWeen added s/needs-info Issue needs more info from the author and removed s/needs-attention Issue has more information and needs another look labels Nov 30, 2022
@ghost
Copy link

ghost commented Nov 30, 2022

Hi @maxkoshevoi. 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.

@dotnet dotnet deleted a comment Nov 30, 2022
@dotnet dotnet deleted a comment Nov 30, 2022
@maxkoshevoi
Copy link
Contributor Author

maxkoshevoi commented Dec 3, 2022

@PureWeen Oh, sorry, was a bit busy last couple of weeks (Ukraine, blackouts, and all that fun stuff) and needs-info pressured to respond in order for issue not get closed 😅

You are right, pushing new TabbedPage modally indeed works (just tested that on my side as well), but as you also pointed out, that's not quite what I'm trying to do.

I wrote Modal by mistake in this comment #7615 (comment), what I meant is:

I'm not using a TabbedPage as a ShellContent (which as I understand is not currently supported, and tracked in #6389), but pushing it on top of the Shell (in a non-modal way)

(also pointed you to a wrong minimal repro here #7615 (comment), sorry again)

The expected result I'm trying to achieve is this: #6389 (comment) (also posted it here #7615 (comment), but as a screenshot, not a video).
And here's the exact code that I'm running, and that is crushing with NRE (it's not a minimal repro, but it can be launched without any ceremony): https://github.com/maxkoshevoi/NureTimetable/blob/84c646ef0bc697712a0be974eb23e6db90152460/NureTimetable/UI/ViewModels/Entities/ManageEntities/ManageEntitiesViewModel.cs#L26

Pushing TabbedPage modally, removes back arrow, update button, and a search bar from the top, which I would like to have.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Dec 3, 2022
@jamesmontemagno
Copy link
Member

@PureWeen I just ran into this issue. It is very easy to reproduce and I would love to get this looked at even with a workaround.

I have an app with A shell with 2 flyout items.

I want to navigate from one flyout item to another page that just so happens to be a TabbedPage. It throws an exception.

Here is a repo sample. Go to page 2 in the flyout and navigate and boom.

https://github.com/jamesmontemagno/MauiApp8

Java.Lang.IllegalArgumentException: 'No view found for id 0x7f080144 (com.companyname.mauiapp8:id/navigationlayout_toptabs) for fragment ViewFragment{585154} (37fae646-12d5-430e-bdd6-1d2694fdeac2 id=0x7f080144)'

If I do platform specifics and put bottom tabs i also get an exception:

Java.Lang.IllegalArgumentException: 'No view found for id 0x7f080142 (com.companyname.mauiapp8:id/navigationlayout_bottomtabs) for fragment ViewFragment{9f2c840} (29c3819a-2bed-48c8-86de-42ef3f890ffd id=0x7f080142)'

@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Sep 13, 2023
@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio Enterprise 17.8.0 Preview 1.0. Can repro on android platform with sample project.
MauiApp8-master.zip
Screenshot 2023-09-13 135945

@Ahmadpashaquarterpi
Copy link

Ahmadpashaquarterpi commented Sep 26, 2023

Is there any work around for this issue?

Or is there any way to push appbar to navigation bar using relative Uri in shell instead of Absolute Uri?

@mydaycare-carefree
Copy link

Any update on this? would really like to use TabbedPage on Android

@mfeingol
Copy link

@PureWeen: I'm seeing the same exception as @jamesmontemagno above. I'd love to be able to use TabbedPage inside a Shell app, but it doesn't look like this is supported at all?

@PureWeen
Copy link
Member

No current updates

Non-shell based pages were heavily reworked for MAUI which made them unfortunately incompatible with shell.

TBH it was a fluke that this scenario even worked in XF and we didn't really have any testing around it because the two weren't really meant to be compatible.

It's on our radar to make them intentionally compatible but I don't have any specific information on timeline.

@mfeingol
Copy link

mfeingol commented Nov 30, 2023

Gotcha. I've tried experimenting with an invisible Tab in a Shell that gets routed to as if it were a detail page. That actually works, but unfortunately back navigation doesn't. But an approach like that might be simpler for Shell apps if you could support it and make it work as expected.

@PureWeen PureWeen added this to the Backlog milestone Dec 15, 2023
@ghost
Copy link

ghost commented Dec 15, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@PureWeen PureWeen removed the s/needs-attention Issue has more information and needs another look label Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants