-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
App crashes with ArgumentOutOfRangeException when FlyoutItemIsVisible changes (WinUI only) #16929
Comments
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 get this too. .NET 7, latest VS updates, both preview and non-preview. I do permissions updates regularly in my app, and if we remove permissions, I remove a flyout item to that module. On WinUI, it crashes when this happens. Works as expected on Android, haven't had a chance to test iOS, but I'm getting there. |
This is a WinUI bug, also reproducible in a native WinUI app. I'll write a separate bug for the WinUI team shortly with more details & link to it here. @Quaybe - iOS should be fine, but of course please let us know if you find otherwise. |
MenuShellItem wraps a MenuItem. Shell related properties should be synchronized between the two objects, always the same values. Add code so that FlyoutItemIsVisible is also synchronized. Most properties are synchroned via bindings, but FlyoutItemIsVisible is an attached property so we need to have code that runs on property changes instead. Fixes issue #16929 Note that normally the MenuItem is specified in XAML while MenuShellItem is accessed in code behind, thus the need to synchronize when FlyoutItemIsVisible is initialized in XAML then updated later via code behind, like in the bug.
The real bug here is in WinUI, tracked with the WinUI bug here: microsoft/microsoft-ui-xaml#8770 |
MenuShellItem wraps a MenuItem. Shell related properties should be synchronized between the two objects, always the same values. Add code so that FlyoutItemIsVisible is also synchronized. Most properties are synchroned via bindings, but FlyoutItemIsVisible is an attached property so we need to have code that runs on property changes instead. Fixes issue #16929 Note that normally the MenuItem is specified in XAML while MenuShellItem is accessed in code behind, thus the need to synchronize when FlyoutItemIsVisible is initialized in XAML then updated later via code behind, like in the bug.
Verified this on Visual Studio Enterprise 17.8.0 Preview 1.0. Repro on Windows 11 .NET 8 with below Project: |
Hi @BretJohnson. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version. You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository. 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. |
I had to fix the routes so that we don't have duplicate routes but it appears that this is fixed now with the latest winui update <ShellContent
Title="Home 1"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage1"
FlyoutItem.IsVisible="{Binding ShowStuff}" />
<ShellContent
Title="Home 2"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage2"
FlyoutItem.IsVisible="{Binding ShowStuff}" />
<ShellContent
Title="Home 3"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage3"
FlyoutItem.IsVisible="{Binding UnshowStuff}" /> |
Description
When FlyoutItemIsVisible changes, the app can crash on WinUI with an ArgumentOutOfRangeException.
This is an issue that @spadapet originally reported here #10468 (comment), now split out to a separate bug.
REPRO:
RESULT:
ArgumentOutOfRangeException, in the WinUI runtime code.
Callstack:
Version with bug
8.0.0-preview.7.8842
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
No. I tried several different options for work arounds and none were completely successful.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: