-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
i/regressionThis issue described a confirmed regression on a currently supported versionThis issue described a confirmed regression on a currently supported versionplatform/windowsregressed-in-9.0.110s/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/a11yRelates to accessibilityRelates to accessibilityt/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
The most recent version of MAUI crashes on Windows when there is a ToolbarItem with non-empty SemanticProperties.Description set. It ends up with an exception:
System.InvalidCastException: Unable to cast object of type 'System.String' to type 'Microsoft.Maui.Controls.VisualElement'.
at System.Runtime.CompilerServices.CastHelpers.ChkCast_Helper(Void* toTypeHnd, Object obj)
at Microsoft.Maui.Controls.Platform.AccessibilityExtensions.SetAutomationPropertiesLabeledBy(FrameworkElement Control, Element Element, IMauiContext mauiContext, UIElement _defaultAutomationPropertiesLabeledBy)
at Microsoft.Maui.Controls.Toolbar.UpdateMenu()
at Microsoft.Maui.Controls.Toolbar.MapToolbarItems(IToolbarHandler arg1, Toolbar arg2)
at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass2_0`2.<ReplaceMapping>b__0(TViewHandler h, TVirtualView v, Action`2 p)
at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass1_0`2.<ModifyMapping>g__newMethod|0(IElementHandler handler, IElement view)
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v)
at Microsoft.Maui.PropertyMapper.TryUpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.PropertyMapper.UpdateProperty(IElementHandler viewHandler, IElement virtualView, String property)
at Microsoft.Maui.Handlers.ElementHandler.UpdateValue(String property)
at Microsoft.Maui.Controls.Toolbar.SetProperty[T](T& backingStore, T value, String propertyName)
at Microsoft.Maui.Controls.Toolbar.set_ToolbarItems(IEnumerable`1 value)
at Microsoft.Maui.Controls.ShellToolbar.<.ctor>b__11_3(Object _, EventArgs __)
at Microsoft.Maui.Controls.MenuItemTracker`1.EmitCollectionChanged()
at Microsoft.Maui.Controls.MenuItemTracker`1.set_Target(Page value)
at Microsoft.Maui.Controls.ShellToolbar.ApplyChanges()
at Microsoft.Maui.Controls.Shell.SendPageAppearing(Page page)
at Microsoft.Maui.Controls.ShellContent.SendPageAppearing(Page page)
at Microsoft.Maui.Controls.ShellContent.SendAppearing()
at Microsoft.Maui.Controls.ShellSection.PresentedPageAppearing()
at Microsoft.Maui.Controls.ShellSection.SendAppearing()
at Microsoft.Maui.Controls.ShellItem.SendAppearing()
at Microsoft.Maui.Controls.ShellNavigationManager.<>c__DisplayClass16_0.<HandleNavigated>g__WaitForWindowToSet|1(Object sender, EventArgs e)
at Microsoft.Maui.Controls.Element.OnChildAdded(Element child)
at Microsoft.Maui.Controls.ShellContent.OnChildAdded(Element child)
at Microsoft.Maui.Controls.Element.AddLogicalChild(Element element)
at Microsoft.Maui.Controls.ShellContent.set_ContentCache(Page value)
at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent()
at Microsoft.Maui.Controls.Handlers.ShellContentHandler.CreatePlatformElement()
at Microsoft.Maui.Handlers.ElementHandler`2.OnCreatePlatformElement()
at Microsoft.Maui.Handlers.ElementHandler.CreatePlatformElement()
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Controls.Handlers.ShellSectionHandler.SyncNavigationStack(Boolean animated, NavigationRequestedEventArgs e)
at Microsoft.Maui.Controls.Handlers.ShellSectionHandler.MapCurrentItem(ShellSectionHandler handler, ShellSection item)
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Handlers.ShellSectionHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Controls.Handlers.ShellItemHandler.UpdateCurrentItem()
at Microsoft.Maui.Controls.Handlers.ShellItemHandler.MapCurrentItem(ShellItemHandler handler, ShellItem item)
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Handlers.ShellItemHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Controls.Platform.ShellView.CreateShellItemView()
at Microsoft.Maui.Controls.Platform.ShellView.SwitchShellItem(ShellItem newItem, Boolean animate)
at Microsoft.Maui.Controls.Handlers.ShellHandler.MapCurrentItem(ShellHandler handler, Shell view)
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Handlers.ViewHandler`2.SetVirtualView(IView view)
at Microsoft.Maui.Controls.Handlers.ShellHandler.SetVirtualView(IView view)
at Microsoft.Maui.Handlers.ViewHandler`2.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.NavigationRootManager.Connect(IWindowHandler handler)
at Microsoft.Maui.Handlers.WindowHandler.MapContent(IWindowHandler handler, IWindow window)
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
at Microsoft.Maui.Platform.ElementExtensions.SetHandler(IWinRTObject nativeElement, IElement element, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.SetWindowHandler(Window platformWindow, IWindow window, IMauiContext context)
at Microsoft.Maui.Platform.ApplicationExtensions.CreatePlatformWindow(Application platformApplication, IApplication application, OpenWindowRequest args)
at Microsoft.Maui.Platform.ApplicationExtensions.CreatePlatformWindow(Application platformApplication, IApplication application, LaunchActivatedEventArgs args)
at Microsoft.Maui.MauiWinUIApplication.OnLaunched(LaunchActivatedEventArgs args)
at Microsoft.UI.Xaml.Application.Microsoft.UI.Xaml.IApplicationOverrides.OnLaunched(LaunchActivatedEventArgs args)
at ABI.Microsoft.UI.Xaml.IApplicationOverrides.Do_Abi_OnLaunched_0(IntPtr thisPtr, IntPtr args)
This is a regression because it used to work in the previous MAUI version.
The latest MAUI version has probably more bugs on Windows. I've experienced that the Shell navigation got stuck and can get into a sitaution that if I click on the item in a flyuout menu, the item is selected but the respective page is not opened. I'll try to reproduce it and post it as a separate issue.
Steps to Reproduce
- Clone the reproduction project https://github.com/holecekp/MAUISR11Bugs
- Run the project on Windows. It crashes instantly.
- Run the project on Android to check that the same code works there. Alternativelly, downgrade to MAUI 9.0.100 and run it on Windows to check that it's a regression and it crashes only in MAUI 9.0.110.
Link to public reproduction project repository
https://github.com/holecekp/MAUISR11Bugs
Version with bug
9.0.110 SR11
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
9.0.100 SR10
Affected platforms
Windows
Affected platform versions
Windows 11
Did you find any workaround?
Downgrade back to MAUI 9.0.100 or don't use accessibility for ToolbarItems.
Relevant log output
Metadata
Metadata
Assignees
Labels
i/regressionThis issue described a confirmed regression on a currently supported versionThis issue described a confirmed regression on a currently supported versionplatform/windowsregressed-in-9.0.110s/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/a11yRelates to accessibilityRelates to accessibilityt/bugSomething isn't workingSomething isn't working