[BUG] MediaElement 1.0.2 crashes on iOS when exiting full screen mode and using AppShell
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Did you read the “Reporting a bug” section on Contributing file?
- I have read the “Reporting a bug” section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
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
- Open and run the solution from the provided repository
- Run the app on an iOS device
- 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
Issue Analytics
- State:
- Created 6 months ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
In iOS 15, when the app is restarted, it immediately crashes.
After the iOS 15 update, the following process causes the app to die. Go to the home screen while running the app; Completely...
Read more >Exiting full screen with Xamarin Forms MediaElement calls ...
However, when I exit from the full-screen mode on iOS, the sound of the video continues to play in the background and the...
Read more >Fullscreen and alt-tab crashing, or windowed with no ...
Fullscreen and alt-tab crashing, or windowed with no brightness option. Any solution? I'm currently going a little mad, trying to figure out ...
Read more >Exiting any fullscreen application causes windows to hang, ...
For some reason, the instant I exit a full-screen game, both SearchApp.exe and dwm.exe stop responding and crash, according to the Event Viewer....
Read more >Consistent Crash on Fullscreen (i am actually going to cry)
Game consistently crashes when set to fullscreen after a seemingly random amount of time, sometimes there's enough to run a full raid, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@MateuszLas421 would you be able to put your scenario in a reproduction project so I’m sure that I’m looking at the right thing? The reproduction attached to this issue seems to work fine (even without the fix)
@jfversluis https://github.com/MateuszLas421/VideoPlayerBug
Example (Shell) project that shows the problem with MediaElement as item on iOS. Problem according to occurs with appshell even if it is not an item.
Visual Studio 17.6.4 XCode 14.3.1