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] VisualDiagnostics/IWindowOverlay with Shell still has issues loading #17677

Closed
drasticactions opened this issue Sep 27, 2023 · 6 comments · Fixed by #20052
Closed
Assignees
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout platform/android 🤖 t/bug Something isn't working
Milestone

Comments

@drasticactions
Copy link
Contributor

Description

#16138

I initially tried to fix this with this PR, but while it does work within the MAUI Repo in Main and net8.0, in a running application the rootNavigation object appears to always be null, so it still doesn't initialize the proper overlay for Shell apps.

Steps to Reproduce

  1. Create an Android app with Shell
  2. Hover over elements within the Live Visual Tree, or try to select elements within LVT.

No adorners are drawn, no elements can be selected.

This should only happen with Shell apps. Non-Shell apps are fine.

Link to public reproduction project repository

No response

Version with bug

8.0.0-rc.1.9171

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@hansmbakker
Copy link

hansmbakker commented Dec 7, 2023

This is unfortunately still an issue with Visual Studio 17.9 Preview 1 / .NET MAUI 8.0.3 - it lowers developer productivity.

Is there a workaround available? Would it e.g. be possible to register some custom handler that patches it in our app until the fix lands in the framework?

@drasticactions
Copy link
Contributor Author

drasticactions commented Dec 7, 2023

Short answer: No, there is no workaround*.

Long answer: https://github.com/drasticactions/maui/blob/main/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellRenderer.cs#L218-L219

As I noted above, the issue is that the NavigationRootManager when using an Android MAUI Shell app is null. My fix got it working when run in the MAUI Source Repo, and in the CI tests, but for reasons I have yet to figure out, it's still null when used in the context of an application. Because it's null, the Window Overlay layer does not initialize, which means the adorner layer won't work. You can't fix that by overriding the handler. This Android fragment has to be fixed, and most likely would require changing how these Android fragments are handled, as Shell and Non-Shell apps do it in different ways.

In terms of when it would be fixed, to be quite frank, there is no timeline, as I'm working on other things within Visual Studio and circle back to this work when I have time. If someone on the MAUI team wants to do it, I'm more than happy to support them.

*that I know of. Of course, it should work with shell on iOS and WinUI. Or if you really want adorners on Android, don't use Shell.

@drasticactions drasticactions added this to the Backlog milestone Dec 7, 2023
@ghost
Copy link

ghost commented Dec 7, 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.

@hansmbakker
Copy link

hansmbakker commented Dec 7, 2023

Thank you for your explanation and transparency! I'll try adding an iOS / WinUI head in that case, as I see it's the only thing in my control (unfortunately I'm not knowledgeable enough at this low-level of MAUI to help).

To the MAUI team - can you please still consider prioritizing this issue, as adding iOS requires more things to be setup (Apple developer account, a Mac, etc) and not all mobile interactions are relevant on Windows?

@hansmbakker
Copy link

hansmbakker commented Dec 7, 2023

I tried Layout Inspector from Android Studio and after some trying, I could connect to my running MAUI Shell app on Android. This is could be a workaround.

The trouble with that is that you can't inspect XAML properties with it, though. You will see the raw Android properties and view names and you will have to make a mental translation yourself.

This is why I still would prefer to use the XAML Live Preview to inspect my app.

@hansmbakker
Copy link

@drasticactions not sure if this helps finding the issue, but I have a very basic Shell app I made for a bug repro where I relied on XLP, and oddly enough there XLP does work.

See:
#17741
https://github.com/hansmbakker/bugrepro-lineheight

@PureWeen PureWeen modified the milestones: Backlog, .NET 8 SR6 Apr 27, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout platform/android 🤖 t/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants