nalu-development / nalu

Provides .NET MAUI packages to help with everyday challenges
https://nalu-development.github.io/nalu/
MIT License
66 stars 2 forks source link

InvalidOperationException: You must use NaluShell to navigate with INavigationService, in sample project #24

Closed sumowesley closed 7 months ago

sumowesley commented 7 months ago

Describe the bug

When running the Nalu.Maui.Sample: Before seeing any screens, I get the InvalidOperationException (You must use NaluShell to navigate with INavigationService). The project is unchanged from the download.

I'm keen to explore the library further and would love to see a comparison with the MAUI navigation in the Nalu.Maui.DefaultShellSample.

Steps to reproduce

  1. Download the source from GitHub
  2. Select Nalu.Maui.Sample and debug
  3. See InvalidOperationException in Nalu.Maui.Navigation.dll nalu_exception

Expected behaviour

I'd expect to see a starting screen so I can see the operation of the navigation.

albyrock87 commented 7 months ago

@sumowesley on which platform are you running the Sample application?

sumowesley commented 7 months ago

It's on Windows 11, @albyrock87

albyrock87 commented 7 months ago

@sumowesley thanks for your bug report.

Nalu.Navigation is mainly focused on mobile platforms (I'm developing from a MacBook so I haven't tested Windows until now). I had an expectation from Shell... to work kind-of similar on every platform, but apparently Windows is really problematic.

I created a branch https://github.com/nalu-development/nalu/tree/windows-desktop-support to add compatibility with Windows platform, but I see a ton of issues. It starts, and many navigations are working, but what I see is:

Considering that Nalu.Maui.Navigation does not contain platform-specific code (except a few iOS lines), I must say all of these issues are related to MAUI implementation. I'm saying that because for example I have no issues at all on Android.

I'm talking to MAUI team in order to see how to solve the situation, but for now, I must say that Windows is not supported due to MAUI bugs.

As soon as I have a workaround I will publish a new version of Nalu and let you know. Thanks again.

sumowesley commented 7 months ago

@albyrock87, I'm very grateful for your detailed response and appreciate your focus; our experience of MAUI on Windows is mixed, at best.

I'll track the branch to check for updates, but I fully understand that you're dependent on changes elsewhere. I'm also very grateful for your quick response.

albyrock87 commented 7 months ago

@sumowesley I just managed to make it work, see attached PR which will be released in a bit as 3.0.3 on NuGet.

If you just want to try it out, checkout the latest main commit here.

Memory leaks are still there, and the background color on the TitleBar under the menu icon is still not working properly, but that's something outside of my library domain.

You can see the icon is there, but I couldn't set the background color anywhere. image Obviously with Nalu you can configure the back icon and the menu icon as you wish, so you can always set a black icon :)

If you want to chat I'm available on Discord with the same username.

sumowesley commented 7 months ago

Hi @albyrock87, I've pulled the main and have it running. I see what you mean about the memory leaks: moving from one to three and back tells me that ThreePage is still alive, and the same with SixPage if I follow the navigation. I started to add your navigation to one of my projects yesterday. I'll update it to 3.0.3 when available and see if I make more progress (it prompted me to look at your Sample project when I stalled). Many thanks for getting something going so quickly.