Skip to content
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

iOS MediaElement in CollectionView on FlyoutPage #2517

Open
2 tasks done
jaredmorley opened this issue Feb 14, 2025 · 3 comments · May be fixed by #2532
Open
2 tasks done

iOS MediaElement in CollectionView on FlyoutPage #2517

jaredmorley opened this issue Feb 14, 2025 · 3 comments · May be fixed by #2532
Labels
bug Something isn't working 📽️ MediaElement Issue/PR that has to do with MediaElement

Comments

@jaredmorley
Copy link

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 a flyout page with a mediaelement in an itemsview such as collectionview crashes in https://github.com/CommunityToolkit/Maui/blob/5d1e343f52f651a14b4f51451e4d4d1c70d3a9c6/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.macios.cs TryGetCurrentPage because the flyoutpage will not use window.Navigation.NavigationStack

Expected Behavior

Not crash and the mediaelement should work

Steps To Reproduce

  1. Run the solution on ios

Link to public reproduction project repository

https://github.com/jaredmorley/MediaElement

Environment

- .NET MAUI CommunityToolkit:11.0.0
- OS:18.1.1
- .NET MAUI:9.0.30

Anything else?

No response

@jaredmorley jaredmorley added bug Something isn't working unverified labels Feb 14, 2025
@ewerspej
Copy link

ewerspej commented Feb 21, 2025

I see something very similar, possibly related, in my MAUI Samples repo on the ReelPage, where it throws an exception with the following native stack trace on iOS:

ObjCRuntime.ObjCException: 'Objective-C exception thrown.  Name: UIViewControllerHierarchyInconsistency
Reason: child view controller:<AVPlayerViewController: 0x11a9d6800> should have parent view controller:<Microsoft_Maui_Controls_Handlers_Items_ReorderableItemsViewController_1: 0x111783200> but actual parent is:<Microsoft_Maui_Controls_Platform_Compatibility_ShellFlyoutRenderer: 0x110ffc400>
Native stack trace:
	0   CoreFoundation                      0x000000018dc087d8 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 534488
	1   libobjc.A.dylib                     0x000000018aedb2e4 objc_exception_throw + 88
	2   CoreFoundation                      0x000000018dd03748 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 1562440
	3   UIKitCore                           0x000000019044fdcc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 933324
	4   UIKitCore                           0x000000019038421c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 98844
	5   UIKitCore                           0x00000001903824e8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 91368
	6   UIKitCore                           0x0000000190382524 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 91428
	7   UIKitCore                           0x000000019038155c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 87388
	8   MauiSamples                         0x000000010165c440 xamarin_dyn_objc_msgSend + 160
	9   MauiSamples                         0x000000010186bc60 do_icall + 200
	10  MauiSamples                         0x000000010186a2a8 do_icall_wrapper + 348
	11  MauiSamples                         0x000000010185f304 mono_interp_exec_method + 2564
	12  MauiSamples                         0x000000010185c6cc interp_entry_from_trampoline + 656
	13  MauiSamples                         0x0000000101619970 native_to_interp_trampoline + 112
	14  MauiSamples                         0x00000001018bb9d0 -[Microsoft_Maui_Controls_Handlers_Items_ItemsViewController_1 collectionView:cellForItemAtIndexPath:] + 116
	15  UIKitCore                           0x0000000190d62340 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 10445632
	16  UIKitCore                           0x00000001903ebf30 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 524080
	17  UIKitCore                           0x00000001905e42d4 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2589396
	18  UIKitCore                           0x00000001905e39b0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2587056
	19  UIKitCore                           0x000000019070eaa8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3812008
	20  UIKitCore                           0x0000000190518f18 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1756952
	21  UIKitCore                           0x00000001906717c4 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3168196
	22  UIKitCore                           0x0000000190379688 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 54920
	23  QuartzCore                          0x000000018f6afc28 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 494632
	24  UIKitCore                           0x00000001903bc138 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 327992
	25  UIKitCore                           0x0000000190dff574 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11089268
	26  UIKitCore                           0x00000001903ebf30 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 524080
	27  UIKitCore                           0x0000000190dff34c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11088716
	28  UIKitCore                           0x0000000190dff890 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11090064
	29  UIKitCore                           0x0000000190c346dc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9209564
	30  UIKitCore                           0x0000000190c72030 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9461808
	31  UIKitCore                           0x00000001918db514 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 22476052
	32  UIKitCore                           0x00000001904b8fe8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1363944
	33  UIKitCore                           0x0000000190c7247c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9462908
	34  UIKitCore                           0x0000000190c71d20 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9461024
	35  UIKitCore                           0x0000000190c32cf0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9202928
	36  UIKitCore                           0x00000001906ddaac 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3611308
	37  UIKitCore                           0x0000000190dfed04 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11087108
	38  UIKitCore                           0x0000000190df4b78 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11045752
	39  UIKitCore                           0x0000000190dfc0ac 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11075756
	40  UIKitCore                           0x0000000190e02cec 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11103468
	41  UIKitCore                           0x0000000191609ad4 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 19520212
	42  UIKitCore                           0x00000001904b751c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1357084
	43  UIKitCore                           0x000000019075b05c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4124764
	44  UIKitCore                           0x0000000190379688 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 54920
	45  QuartzCore                          0x000000018f6afc28 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 494632
	46  QuartzCore                          0x000000018f6af7b4 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 493492
	47  QuartzCore                          0x000000018f706914 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 850196
	48  QuartzCore                          0x000000018f6857c4 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 321476
	49  UIKitCore                           0x000000019040f588 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 669064
	50  UIKitCore                           0x000000019040cb64 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 658276
	51  UIKitCore                           0x000000019040c9d8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 657880
	52  UIKitCore                           0x000000019040c628 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 656936
	53  UIKitCore                           0x000000019040d59c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 660892
	54  CoreFoundation                      0x000000018dbdc328 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 353064
	55  CoreFoundation                      0x000000018dbdc2bc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 352956
	56  CoreFoundation                      0x000000018dbd9dc0 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 343488
	57  CoreFoundation                      0x000000018dbd8fbc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 339900
	58  CoreFoundation                      0x000000018dbd8830 CFRunLoopRunSpecific + 588
	59  GraphicsServices                    0x00000001d9bb81c4 GSEventRunModal + 164
	60  UIKitCore                           0x000000019073eeb0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4009648
	61  UIKitCore                           0x00000001907ed5b4 UIApplicationMain + 340
	62  MauiSamples                         0x00000001016305f4 xamarin_UIApplicationMain + 60
	63  MauiSamples                         0x000000010186bcd4 do_icall + 316
	64  MauiSamples                         0x000000010186a2a8 do_icall_wrapper + 348
	65  MauiSamples                         0x000000010185f304 mono_interp_exec_method + 2564
	66  MauiSamples                         0x000000010185ced0 interp_runtime_invoke + 236
	67  MauiSamples                         0x000000010182b7ac mono_jit_runtime_invoke + 1244
	68  MauiSamples                         0x00000001017d358c mono_runtime_invoke_checked + 148
	69  MauiSamples                         0x00000001017d9490 mono_runtime_exec_main_checked + 116
	70  MauiSamples                         0x00000001018321c4 mono_jit_exec + 356
	71  MauiSamples                         0x000000010165b3b0 xamarin_main + 2312
	72  MauiSamples                         0x000000010189c9c8 main + 64
	73  dyld                                0x00000001b35c6ec8 3060D36A-16CE-3C3A-9258-3881459F5714 + 212680

Note the reason it gives:

Reason: child view controller:<AVPlayerViewController: 0x11a9d6800> should have parent view controller:<Microsoft_Maui_Controls_Handlers_Items_ReorderableItemsViewController_1: 0x111783200> but actual parent is:<Microsoft_Maui_Controls_Platform_Compatibility_ShellFlyoutRenderer

Actually, I'm not using a FlyoutPage, and Flyout is disabled in the AppShell.xaml, but I still get that exception.

@vhugogarcia vhugogarcia added the 📽️ MediaElement Issue/PR that has to do with MediaElement label Feb 21, 2025
@ne0rrmatrix
Copy link
Contributor

I see something very similar, possibly related, in my MAUI Samples repo on the ReelPage, where it throws an exception with the following native stack trace on iOS:

ObjCRuntime.ObjCException: 'Objective-C exception thrown. Name: UIViewControllerHierarchyInconsistency
Reason: child view controller:<AVPlayerViewController: 0x11a9d6800> should have parent view controller:<Microsoft_Maui_Controls_Handlers_Items_ReorderableItemsViewController_1: 0x111783200> but actual parent is:<Microsoft_Maui_Controls_Platform_Compatibility_ShellFlyoutRenderer: 0x110ffc400>
Native stack trace:
0 CoreFoundation 0x000000018dc087d8 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 534488
1 libobjc.A.dylib 0x000000018aedb2e4 objc_exception_throw + 88
2 CoreFoundation 0x000000018dd03748 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 1562440
3 UIKitCore 0x000000019044fdcc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 933324
4 UIKitCore 0x000000019038421c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 98844
5 UIKitCore 0x00000001903824e8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 91368
6 UIKitCore 0x0000000190382524 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 91428
7 UIKitCore 0x000000019038155c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 87388
8 MauiSamples 0x000000010165c440 xamarin_dyn_objc_msgSend + 160
9 MauiSamples 0x000000010186bc60 do_icall + 200
10 MauiSamples 0x000000010186a2a8 do_icall_wrapper + 348
11 MauiSamples 0x000000010185f304 mono_interp_exec_method + 2564
12 MauiSamples 0x000000010185c6cc interp_entry_from_trampoline + 656
13 MauiSamples 0x0000000101619970 native_to_interp_trampoline + 112
14 MauiSamples 0x00000001018bb9d0 -[Microsoft_Maui_Controls_Handlers_Items_ItemsViewController_1 collectionView:cellForItemAtIndexPath:] + 116
15 UIKitCore 0x0000000190d62340 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 10445632
16 UIKitCore 0x00000001903ebf30 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 524080
17 UIKitCore 0x00000001905e42d4 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2589396
18 UIKitCore 0x00000001905e39b0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2587056
19 UIKitCore 0x000000019070eaa8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3812008
20 UIKitCore 0x0000000190518f18 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1756952
21 UIKitCore 0x00000001906717c4 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3168196
22 UIKitCore 0x0000000190379688 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 54920
23 QuartzCore 0x000000018f6afc28 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 494632
24 UIKitCore 0x00000001903bc138 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 327992
25 UIKitCore 0x0000000190dff574 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11089268
26 UIKitCore 0x00000001903ebf30 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 524080
27 UIKitCore 0x0000000190dff34c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11088716
28 UIKitCore 0x0000000190dff890 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11090064
29 UIKitCore 0x0000000190c346dc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9209564
30 UIKitCore 0x0000000190c72030 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9461808
31 UIKitCore 0x00000001918db514 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 22476052
32 UIKitCore 0x00000001904b8fe8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1363944
33 UIKitCore 0x0000000190c7247c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9462908
34 UIKitCore 0x0000000190c71d20 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9461024
35 UIKitCore 0x0000000190c32cf0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 9202928
36 UIKitCore 0x00000001906ddaac 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3611308
37 UIKitCore 0x0000000190dfed04 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11087108
38 UIKitCore 0x0000000190df4b78 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11045752
39 UIKitCore 0x0000000190dfc0ac 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11075756
40 UIKitCore 0x0000000190e02cec 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11103468
41 UIKitCore 0x0000000191609ad4 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 19520212
42 UIKitCore 0x00000001904b751c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1357084
43 UIKitCore 0x000000019075b05c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4124764
44 UIKitCore 0x0000000190379688 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 54920
45 QuartzCore 0x000000018f6afc28 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 494632
46 QuartzCore 0x000000018f6af7b4 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 493492
47 QuartzCore 0x000000018f706914 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 850196
48 QuartzCore 0x000000018f6857c4 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 321476
49 UIKitCore 0x000000019040f588 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 669064
50 UIKitCore 0x000000019040cb64 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 658276
51 UIKitCore 0x000000019040c9d8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 657880
52 UIKitCore 0x000000019040c628 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 656936
53 UIKitCore 0x000000019040d59c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 660892
54 CoreFoundation 0x000000018dbdc328 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 353064
55 CoreFoundation 0x000000018dbdc2bc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 352956
56 CoreFoundation 0x000000018dbd9dc0 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 343488
57 CoreFoundation 0x000000018dbd8fbc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 339900
58 CoreFoundation 0x000000018dbd8830 CFRunLoopRunSpecific + 588
59 GraphicsServices 0x00000001d9bb81c4 GSEventRunModal + 164
60 UIKitCore 0x000000019073eeb0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4009648
61 UIKitCore 0x00000001907ed5b4 UIApplicationMain + 340
62 MauiSamples 0x00000001016305f4 xamarin_UIApplicationMain + 60
63 MauiSamples 0x000000010186bcd4 do_icall + 316
64 MauiSamples 0x000000010186a2a8 do_icall_wrapper + 348
65 MauiSamples 0x000000010185f304 mono_interp_exec_method + 2564
66 MauiSamples 0x000000010185ced0 interp_runtime_invoke + 236
67 MauiSamples 0x000000010182b7ac mono_jit_runtime_invoke + 1244
68 MauiSamples 0x00000001017d358c mono_runtime_invoke_checked + 148
69 MauiSamples 0x00000001017d9490 mono_runtime_exec_main_checked + 116
70 MauiSamples 0x00000001018321c4 mono_jit_exec + 356
71 MauiSamples 0x000000010165b3b0 xamarin_main + 2312
72 MauiSamples 0x000000010189c9c8 main + 64
73 dyld 0x00000001b35c6ec8 3060D36A-16CE-3C3A-9258-3881459F5714 + 212680
Note the reason it gives:

Reason: child view controller:<AVPlayerViewController: 0x11a9d6800> should have parent view controller:<Microsoft_Maui_Controls_Handlers_Items_ReorderableItemsViewController_1: 0x111783200> but actual parent is:<Microsoft_Maui_Controls_Platform_Compatibility_ShellFlyoutRenderer

Actually, I'm not using a FlyoutPage, and Flyout is disabled in the AppShell.xaml, but I still get that exception.

Can you update your global.json to use current recommended settings? Example:

{
  "sdk": {
    "version": "9.0.200",
    "rollForward": "latestFeature",
    "allowPrerelease": false
  }
}

Your version in maui-samples points to a much older version for dotnet 8.x

@ewerspej
Copy link

Can you update your global.json to use current recommended settings? Example:

{
  "sdk": {
    "version": "9.0.200",
    "rollForward": "latestFeature",
    "allowPrerelease": false
  }
}

Your version in maui-samples points to a much older version for dotnet 8.x

The issue still persists with those settings. I've also manually updated the installed workloads using dotnet workload update.

Are you able to reproduce the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📽️ MediaElement Issue/PR that has to do with MediaElement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants