How can I solve System.Runtime.InteropServices.COMException using SpeechRecognizer UWP?

0

I'm getting a System.Runtime.InteropServices.COMException (0x80070490) using SpeechRecognizer.

I've read online that this error might be caused by a capability not being enabled or that the manifest is corrupt.

I have Internet (Client) and Microphone enabled, I also tried a clean manifest file, but it results in the same error message.

Does anybody know what I'm doing wrong? This is an UWP app and I'm using Windows 10 Build 1709.

My code:

using System;
using System.Diagnostics;
using Windows.Media.SpeechRecognition;

namespace SpeechRecognitionRPi
{
    class SpeechHandling
    {
        public async void StartRecognition()
        {
            // Create an instance of SpeechRecognizer.
            var speechRecognizer = new SpeechRecognizer();

            // Compile the dictation grammar by default.
            await speechRecognizer.CompileConstraintsAsync();

            // Start recognition.
            SpeechRecognitionResult speechRecognitionResult = await speechRecognizer.RecognizeWithUIAsync();

            // Do something with the recognition result.
            var messageDialog = new Windows.UI.Popups.MessageDialog(speechRecognitionResult.Text, "Text spoken");
            await messageDialog.ShowAsync();

        }
    }
}
c#
uwp
win-universal-app
speech-recognition
asked on Stack Overflow May 1, 2018 by stickfigure4 • edited May 2, 2018 by Vincent Elbert Budiman

1 Answer

0

Fixed by enabling the English-US language in Windows, you also need to install the speech module from Language options.

answered on Stack Overflow May 2, 2018 by stickfigure4

User contributions licensed under CC BY-SA 3.0