Skip to content

[BUG] MediaElement 1.0.2 crashes on iOS when exiting full screen mode and using AppShell #1110

@blackforest-tom

Description

@blackforest-tom

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

Using an untouched new MAUI project (using AppShell) with CommunityToolkit.MediaElement 1.0.2 from NuGet and adding a video player (MediaElement tag) it is not possible to exit full screen mode on iOS without the App crashing with the following exception:

ObjCRuntime.ObjCException
  Nachricht = Objective-C exception thrown.  Name: UIViewControllerHierarchyInconsistency Reason: child view controller:<AVPlayerViewController: 0x10e94dc00> should have parent view controller:<Microsoft_Maui_Controls_Platform_Compatibility_ShellSectionRootRenderer: 0x10563de00> but actual parent is:<Microsoft_Maui_Platform_PageViewController: 0x1057bd2e0>
Native stack trace:
	0   CoreFoundation                      0x0000000180c63c94 309E77AA-4FF2-35B9-8AF6-33AF9C2B7929 + 601236
	1   libobjc.A.dylib                     0x0000000198489ee4 objc_exception_throw + 56
	2   CoreFoundation                      0x0000000180cb6e84 309E77AA-4FF2-35B9-8AF6-33AF9C2B7929 + 941700
	3   UIKitCore                           0x00000001833be11c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 4919580
	4   UIKitCore                           0x00000001832f8334 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 4109108
	5   UIKitCore                           0x00000001830b8350 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749840
	6   UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	7   UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	8   UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	9   UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	10  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	11  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	12  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	13  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	14  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	15  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	16  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	17  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	18  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	19  UIKitCore                           0x00000001830b836c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1749868
	20  UIKitCore                           0x0000000183086604 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1545732
	21  AVKit                               0x0000000199d26874 D49827F4-890B-380B-AF26-74D929D46993 + 714868
	22  UIKitCore                           0x00000001830702c4 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1454788
	23  AVKit                               0x0000000199d2596c D49827F4-890B-380B-AF26-74D929D46993 + 711020
	24  AVKit                               0x0000000199d43358 D49827F4-890B-380B-AF26-74D929D46993 + 832344
	25  UIKitCore                           0x0000000183396fd0 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 4759504
	26  UIKitCore                           0x00000001831d5500 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 2917632
	27  UIKitCore                           0x00000001832480c4 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 3387588
	28  UIKitCore                           0x00000001832ceb84 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 3939204
	29  UIKitCore                           0x0000000183172278 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 2511480
	30  UIKitCore                           0x000000018379d3cc 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 8979404
	31  UIKitCore                           0x0000000183219234 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 3195444
	32  UIKitCore                           0x0000000183134764 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 2258788
	33  UIKitCore                           0x0000000183062ea4 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1400484
	34  UIKitCore                           0x0000000183063570 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1402224
	35  UIKitCore                           0x000000018306373c 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 1402684
	36  CoreFoundation                      0x0000000180c0f78c 309E77AA-4FF2-35B9-8AF6-33AF9C2B7929 + 255884
	37  CoreFoundation                      0x0000000180be09b4 309E77AA-4FF2-35B9-8AF6-33AF9C2B7929 + 63924
	38  CoreFoundation                      0x0000000180bdbf3c 309E77AA-4FF2-35B9-8AF6-33AF9C2B7929 + 44860
	39  CoreFoundation                      0x0000000180bef194 CFRunLoopRunSpecific + 572
	40  GraphicsServices                    0x00000001a1726988 GSEventRunModal + 160
	41  UIKitCore                           0x00000001833f2a88 697C7D5C-9761-36E9-8E0F-200035BF3F39 + 5134984
	42  UIKitCore                           0x000000018318bfc8 UIApplicationMain + 336
	43  VideoPlaybackTest                   0x0000000104abc5a4 xamarin_UIApplicationMain + 60
	44  VideoPlaybackTest                   0x0000000104ddc6f0 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2368984
	45  VideoPlaybackTest                   0x0000000104ddb410 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2364152
	46  VideoPlaybackTest                   0x0000000104dd0dec _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2321620
	47  VideoPlaybackTest                   0x0000000104dce9c0 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2312360
	48  VideoPlaybackTest                   0x0000000104d9f9c8 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2119856
	49  VideoPlaybackTest                   0x0000000104cee9c0 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1394856
	50  VideoPlaybackTest                   0x0000000104cf5268 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1421648
	51  VideoPlaybackTest                   0x0000000104da4bc4 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2140844
	52  VideoPlaybackTest                   0x0000000104ae7528 xamarin_get_original_working_directory_path + 4016
	53  VideoPlaybackTest                   0x0000000104e0ad8c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2559092
	54  dyld                                0x00000001054984d0 start + 444

  Quelle = Microsoft.iOS
  Stapelüberwachung:
   at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle)
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
   at VideoPlaybackTest.Program.Main(String[] args) in D:\Code\test\VideoPlaybackTest\VideoPlaybackTest\Platforms\iOS\Program.cs:line 13

Expected Behavior

The app should not crash when exiting full screen on iOS devices.

Steps To Reproduce

  1. Open and run the solution from the provided repository
  2. Run the app on an iOS device
  3. Enter and exit full screen mode of the video.

Link to public reproduction project repository

https://github.com/blackforest-tom/maui-mediaelement-bug-102

Environment

- .NET MAUI CommunityToolkit.MediaElement: 1.0.2
- OS: iOS 15.7.1
- .NET MAUI: 7.0.59

Anything else?

The issue is not reproducible if you use MediaElement v1.0.1, or if you swap out the AppShell and directly instantiate the MainPage by changing
MainPage = new AppShell();
to
MainPage = new MainPage();
in App.xaml.cs

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions