CommunityToolkit / CommunityToolkit/Maui
[BUG] MediaElement Throws Exception in TabView-like Layouts on iOS and Mac
- Dominant language
- C#
- Stars
- 2.7k
- Forks
- 500
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 7
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Did you read the "Reporting a bug" section on Contributing file?
- [x] 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
### Issue Description:
When using the MediaElement control inside a TabView-like layout (including custom TabView implementations), an exception occurs on iOS and Mac platforms. This issue is reproducible even without using SfTabView, indicating that the root cause is related to the MediaElement control.
### Output:
### Issue Replicated sample:
[Sample.zip](https://github.com/user-attachments/files/29138974/Sample.zip)
### Actual Behavior:
An exception is thrown when rendering or interacting with the MediaElement.
The issue occurs specifically on iOS and Mac platforms.
The same issue is reproducible even with a custom TabView (without SfTabView), confirming it is not related to third-party controls.
### Expected Behavior
The MediaElement should load and play media correctly within each tab.
No exceptions should occur while switching tabs or rendering multiple views.
### Steps To Reproduce
Create a .NET MAUI application.
Implement a TabView-like structure (either Toolkit TabView or custom TabView using MAUI controls).
Place a MediaElement inside each tab (or within a templated layout).
Run the application on iOS or Mac.
Navigate between tabs.
### Link to public reproduction project repository
https://github.com/[TameemAnsari-SF4702/Issue_Sample](https://github.com/TameemAnsari-SF4702/Issue_Sample)
### Environment
```markdown
- .NET MAUI CommunityToolkit: 10.0.0
- OS: Mac 26.5
- .NET MAUI: 10.0.70
```
### Anything else?
_No response_
Contributor guide
Research direction
Start with the linked Issue_Sample reproduction project or Sample.zip and run the .NET MAUI app on iOS and Mac. Reproduce the exception while rendering MediaElement instances and switching between tabs, comparing Toolkit TabView-like and custom TabView layouts. Done means MediaElement loads and plays in each tab without exceptions on both platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, ios, macos
- Domain
- desktop-dev, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100