You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On MacCatalyst, when using a MediaElement in a DataTemplate on a page that contains multiple ItemsViews, the following exception is thrown:
System.NotSupportedException: MediaElement is not currently supported in multi-window applications
at CommunityToolkit.Maui.Core.Views.MauiMediaElement.TryGetCurrentPage(Page) in /Users/minnbran/GitHub/CommunityToolkit.Maui/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.macios.cs:line 132
at CommunityToolkit.Maui.Core.Views.MauiMediaElement..ctor(AVPlayerViewController playerViewController, MediaElement virtualView) in /Users/minnbran/GitHub/CommunityToolkit.Maui/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.macios.cs:line 52
at CommunityToolkit.Maui.Core.Handlers.MediaElementHandler.CreatePlatformView() in /Users/minnbran/GitHub/CommunityToolkit.Maui/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.macios.cs:line 27
at Microsoft.Maui.Handlers.ViewHandler`2[[CommunityToolkit.Maui.Views.MediaElement, CommunityToolkit.Maui.MediaElement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[CommunityToolkit.Maui.Core.Views.MauiMediaElement, CommunityToolkit.Maui.MediaElement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnCreatePlatformView()
at Microsoft.Maui.Handlers.ViewHandler.OnCreatePlatformElement()
at Microsoft.Maui.Handlers.ElementHandler.CreatePlatformElement()
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Handlers.ViewHandler`2[[CommunityToolkit.Maui.Views.MediaElement, CommunityToolkit.Maui.MediaElement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[CommunityToolkit.Maui.Core.Views.MauiMediaElement, CommunityToolkit.Maui.MediaElement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view)
at Microsoft.Maui.Handlers.ViewHandler`2[[CommunityToolkit.Maui.Views.MediaElement, CommunityToolkit.Maui.MediaElement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[CommunityToolkit.Maui.Core.Views.MauiMediaElement, CommunityToolkit.Maui.MediaElement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].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.Handlers.LayoutHandler.SetVirtualView(IView view)
at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.LayoutView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].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.Handlers.BorderHandler.UpdateContent(IBorderHandler handler)
at Microsoft.Maui.Handlers.BorderHandler.MapContent(IBorderHandler handler, IBorderView border)
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.IBorderView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IBorderHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v)
at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IBorderView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view)
at Microsoft.Maui.Handlers.BorderHandler.SetVirtualView(IView view)
at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IBorderView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].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.ViewExtensions.ToHandler(IView view, IMauiContext context)
at Microsoft.Maui.Controls.Handlers.Items.TemplateHelpers.GetHandler(View view, IMauiContext context)
at Microsoft.Maui.Controls.Handlers.Items.TemplatedCell.Bind(DataTemplate template, Object bindingContext, ItemsView itemsView)
at Microsoft.Maui.Controls.Handlers.Items.ItemsViewController`1[[Microsoft.Maui.Controls.CarouselView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].UpdateTemplatedCell(TemplatedCell cell, NSIndexPath indexPath)
at Microsoft.Maui.Controls.Handlers.Items.CarouselViewController.GetCell(UICollectionView collectionView, NSIndexPath indexPath)
at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 61
at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 96
at CommunityToolkit.Maui.Sample.Program.Main(String[] args) in /Users/minnbran/GitHub/CommunityToolkit.Maui/samples/CommunityToolkit.Maui.Sample/Platforms/iOS/Program.cs:line 7
This is a known bug where a NotSupportedException is thrown:
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
On MacCatalyst, when using a MediaElement in a
DataTemplate
on a page that contains multipleItemsViews
, the following exception is thrown:This is a known bug where a
NotSupportedException
is thrown:Maui/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.macios.cs
Line 132 in ed06645
Expected Behavior
The MediaElement should work on MacCatalyst when using multiple windows.
Steps To Reproduce
Link to public reproduction project repository
https://github.com/CommunityToolkit/Maui/tree/main/samples
Environment
Anything else?
This bug does not currently affect .NET 8, but may affect .NET 9 that deprecates
Application.MainPage
in favor ofApplication.CreateWindow(IApplicationState)
: https://learn.microsoft.com/en-us/dotnet/maui/whats-new/dotnet-9?view=net-maui-8.0#mainpageThe text was updated successfully, but these errors were encountered: