Open singhwong opened 1 year ago
Thank you for the report! You said that this used to work on an unknown version. Was this working in .NET 7?
Hi @singhwong. 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.
This issue occurs when using MacOS Sonoma 14 + .net7 7.0.400 + maui 7.0.96
or MacOS Sonoma 14 + .net8 8.0.100-rc.2.23502.2 + maui 8.0.0-rc.2.9373,
and what I can be sure of is that when using the previous version of maui (maui 7.0.92
) + the previous version of macOS (not sonoma), working properly.
As far as I can tell This will be happening regardless of the version of MAUI being used, going by how the underlying control is written:
https://github.com/dotnet/maui/blob/main/src/Core/src/Handlers/Picker/PickerHandler.iOS.cs#L41
The Maui Picker is a wrapper around a UITextField that fires a UIAlert to show a picker. That code doesn't work on Sonoma, it'll just show the alert. There's probably gonna need to be some rethinking around how that control works.
e.
So I believe the way this worked was by using UITextView
. When you tapped it, it will fire an event on edit to create a UIAlertController with an ActionSheet style, and hijack it by replacing its underlying view with a UIPickerView instead. My guess is that, while possible since the View is publicly exposed, it's against the spirit of the control and that broke with Sonoma and/or Xcode so it actually shows the Alert now. @rolfbjarne would you have any ideas for this? It seems like how this is written was kinda fragile.
@rolfbjarne would you have any ideas for this? It seems like how this is written was kinda fragile.
Why was a UIAlertController needed in the first place? What's the test code supposed to do?
@rmarinho Do you remember why we had to write it this way?
Hi, this is a critical issue for us going into .NET 8 - our app makes use of pickers, and they are simply not functional in this state. Additionally, the current implementation of Picker on Catalyst does not work at all when using the Desktop idiom, and actually causes the entire app to crash.
As a core control in MAUI, I believe this should be considered and prioritised as a major issue since it will block customer releases - in our case, we just can't release our app at all, and the bugs that remain in .NET 7 mean that is not an option for us either.
@samhouts Please reconsider removing this from the .NET 8 GA milestone!
What does this mean? will be fixed before .NET 8 GA release?
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.
I have noticed with my app on MacCatalyst that the menu bars and DisplayActionSheet have stopped working since the latest updates. I was looking through the maui-samples for something to demonstrate this and found that the pickers are also not working. I assume this is related but perhaps it is not.
Just throwing it out there in case it helps anyone: we've quickly knocked together a simple picker-type control using the popup stuff from the MAUI Community Toolkit and a CollectionView being invoked from a read only Entry with a TapGesture - it's rudimentary, but, it gets the job done within our context and it didn't take long to write.
For what it's worth, it's probably worth looking at something like that if you're in a jam; after doing way too much reading, I'd guess the UIKit Picker's compatibility with Catalyst and the surprising amount of complication around what you can/cannot do entered into this at some point. The control is a bit rubbish on desktop even without any .NET involved (horrible with a mouse), and it's entirely unsupported by Apple on the desktop idiom too just to add to its lameness, so now I'm not panicking and have an easy alternative I'm realising it's not a huge loss in the end.
EDIT: All this being said, this is now a bit of a gap - maybe something for MCT?
Confirmed in 8.0.4-nightly.9742
I found that the Picker
works on Mac Catalyst so long as I don't use the Title
property.
<Picker x:Name="AppearancePicker"
Title="Appearance"
BackgroundColor="Transparent">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Unspecified</x:String>
<x:String>Dark</x:String>
<x:String>Light</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
Removed Title
:
<Picker x:Name="AppearancePicker"
BackgroundColor="Transparent">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Unspecified</x:String>
<x:String>Dark</x:String>
<x:String>Light</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
@davidortinau thanks for the heads up about removing the title, I've put an OnPlatform
to bodge my way around this for mac:
<Picker
ItemDisplayBinding="{Binding Name}"
ItemsSource="{Binding ServiceConnections}"
SelectedItem="{Binding SelectedConnection}"
TextColor="{StaticResource White}"
TitleColor="LightGray"
Title="{OnPlatform iOS='Select an environment...',
Android='Select an environment...',
WinUI='Select an environment...'}" />
I'm happy there is a workaround & know theres still alot todo for maui but I hope this gets fixed soon because its really impacts the use case of mac catalyst if the basic controls don't actually work 😔
In version 8.0.201, the Picker stop working again, even without the Title property set.
This is still happening in .NET 8 RC5
This issue has been verified using Visual Studio For MAC 17.6.14(build413)(8.0.80 & 8.0.3 & 7.0.101). Can repro on MacCatalyst platform. Verified working fine on 7.0.96.
I'm still seeing this behaviour in .NET 9 MAUI builds too
Description
Picker is empty on mac catalyst, no list is displayed, just a pop-up window.
Steps to Reproduce
Link to public reproduction project repository
No response
Version with bug
7.0.96
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
Unknown/Other
Affected platforms
macOS
Affected platform versions
macOS Sonoma 14.0
Did you find any workaround?
No response
Relevant log output
No response