CodecQuery.FindAllAsync crashes through try/catch when querying Audio codecs without subtype

Luke Vo 1 Reputation point
2021-02-19T03:33:42.287+00:00

This was asked here but here I get some more details: I created a new UWP project with only the following code:

        public MainPage()
        {
            this.InitializeComponent();

            this.Loaded += this.MainPage_Loaded;
        }

        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                var query = new CodecQuery();
                var codecs = await query.FindAllAsync(CodecKind.Audio, CodecCategory.Encoder, "");
            }
            catch (Exception ex)
            {
                // It does not even go here
                Debug.WriteLine(ex);
            }
        }

I would have a crash even though the crashing line is within try/catch block. I switched the debug mode to Mixed and receive the following message:

Unhandled exception at 0x76FAA8B2 (KernelBase.dll) in App1.exe: 0xC0000002: The requested operation is not implemented.

The code would run well if it's Video, or if I put a specific subtype instead of empty string, but I need to get all the available codecs.

Please advice how I should solve this problem. Thanks.

Universal Windows Platform (UWP)
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,422 questions
{count} votes