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

MenuBarItem Commands not working on Mac Catalyst #20685

Closed
beeradmoore opened this issue Feb 19, 2024 · 10 comments · Fixed by #20699
Closed

MenuBarItem Commands not working on Mac Catalyst #20685

beeradmoore opened this issue Feb 19, 2024 · 10 comments · Fixed by #20699
Labels
area-controls-menubar Desktop MenuBarItems fixed-in-8.0.10 fixed-in-9.0.0-preview.2.10293 i/regression This issue described a confirmed regression on a currently supported version platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Milestone

Comments

@beeradmoore
Copy link
Contributor

beeradmoore commented Feb 19, 2024

Description

Trying to add a menu (initially following Display a menu bar in a .NET MAUI desktop app). The menu is added but clicking MenuFlyoutItem does not execute its commands.

I hit this problem in another app where BindingContext was null. I came across #5382, but I have 2 workarounds in there and neither of them work. Additionally I output the BindingContext of menu MenuBarItem and they are an object as expected and not null so it is likely not the same issue.

Issue only present on macOS. Works fine in Windows.

Steps to Reproduce

  1. Create new MAUI app.
  2. Add a menu
  3. Link commands up how you see fit (I used CommunityToolkit.MVVM)
  4. Run the program and try click a menu item

Does the command execute? With my sample neither FooBar hit is output or Debugger.Break(); is hit.

Link to public reproduction project repository

https://github.com/beeradmoore/maui-issue-MenuBarItemBinding

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

macOS 14.3

Did you find any workaround?

No

Relevant log output

No response

@beeradmoore beeradmoore added the t/bug Something isn't working label Feb 19, 2024
@jsuarezruiz jsuarezruiz added platform/macOS 🍏 macOS / Mac Catalyst area-controls-menubar Desktop MenuBarItems labels Feb 19, 2024
@drasticactions
Copy link
Contributor

MauiApp5382.zip

Bumping the sample to .NET 8, if I leave off the MAUI version or use 8.0.3 the base Command binding works fine, but bumping to 8.0.7 it fails. Changing your sample to match to 8.0.3, cleaning, and rebuilding, and the original RelayCommand works fine as well. My guess is there may be a regression between the two versions, but I'm not sure what changed.

@jfversluis jfversluis added the i/regression This issue described a confirmed regression on a currently supported version label Feb 19, 2024
@beeradmoore
Copy link
Contributor Author

Confirmed with my repo if I change

<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.7" />

back to

<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.6" />

all the buttons start working again, I didn't need to go back to 8.0.3. @drasticactions would you be able to confirm that you don't need to go back to 8.0.3 either and that 8.0.6 restores functionality again? (uncase I am not rebuild/clearing correctly)

I eyeballed the changelog for 8.0.7 and I couldn't see anything related, maybe it is in the PRs but not the release notes?

@drasticactions
Copy link
Contributor

I didn't test 8.0.6, trying it now and yeah, that seems to work correctly.

@beeradmoore
Copy link
Contributor Author

Thanks for that.

Earlier I was looking at the diff between the two tags I saw something about Mac Catalyst SDK was updated. Forgot to check what that was (if it was a core thing or a sample or something) to see if it could impact anything. The I recall the change was to bring it from the Nov 2023 release so it could have been the first .NET 8 release. But again, forgot to check if that was anything that would impact an app when I have the latest SDK here.

I eyeballed the changes over the Xamarin.macios repo and nothing jumped out to me.

At least a workaround is to use 8.0.6 for now.

@drasticactions
Copy link
Contributor

drasticactions commented Feb 19, 2024

Got a fix:

#19800

This PR broke the UI Selectors from firing, since it was set to static and that won't work, since it's an exported value. Removing it causes it to fire again. This also means that Clicked handles were broken too.

@jsuarezruiz jsuarezruiz added this to the Backlog milestone Feb 19, 2024
@ghost
Copy link

ghost commented Feb 19, 2024

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.

@beeradmoore
Copy link
Contributor Author

Thanks for getting that sorted so quickly. I'll roll back to 8.0.6 until 8.0.8 is out

@PureWeen
Copy link
Member

@beeradmoore have you validated on our nightly builds if the issue is fixed for you?

https://github.com/dotnet/maui/wiki/Nightly-Builds

@PureWeen PureWeen modified the milestones: Backlog, .NET 8 SR3 Feb 21, 2024
@PureWeen PureWeen moved this from Todo to Done in MAUI SDK Ongoing Feb 21, 2024
@beeradmoore
Copy link
Contributor Author

@PureWeen , I went to 8.0.10-nightly.10061 and it doesn't seem fixed. Deleted bin/obj and reloaded Rider to be sure a rebuild didn't do it. Is there a specific version listed in #20699 I am meant to be using?

I created a branch of my above repository which uses 8.0.10-nightly.10061.

@davidortinau
Copy link
Contributor

Confirmed in my app this is fixed in 8.0.14

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-menubar Desktop MenuBarItems fixed-in-8.0.10 fixed-in-9.0.0-preview.2.10293 i/regression This issue described a confirmed regression on a currently supported version platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants