MediaSource.ExternalTimedTextSources.Clear causes unhandled exception if loaded TimeTextSource was not valid #9663
Labels
area-External
Not owned by the WinUI team, not actionable in this repository.
closed-Fixed
Described behavior has been fixed.
Describe the bug
MediaSource.ExternalTimedTextSources.Clear causes unhandled exception if loaded TimeTextSource was not valid. Remove also causes exception. The exception is 'Invalid index'. It is caught by the app's unhandled exception handler but can't be caught by a wrapping try-catch block. Note there is no way to tell the TimeTextSource was invalid without loading it (The 'Resolved' handler is called after load, but I have omitted it from the code below as not needed).
Steps to reproduce the bug
Here's s minimal app. First, select a video using the 'Load video' button. Then, select an invalid subtitle file using the 'Select subtitles' button (can just select the video again), then, load another subtitles file (valid or invalid). App crashes when trying to clear the ExternalTimedTextSources.
Expected behavior
No crash.
Screenshots
No response
NuGet package version
None
Packaging type
No response
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
Doesn't need WinAppSDK, bug is in Windows.Media.
The text was updated successfully, but these errors were encountered: