Open bencambridgemaths opened 1 month ago
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
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.