MikePR MikePR - 1 month ago 11
C# Question

Exception HRESULT: 0x800455BC in speech recognition in Windows phone 8

I am developing a new app where I am using the speech recognition capability for windows phone 8. However, I am getting the following exception:


Exception from HRESULT: 0x800455BC

at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at ExcerciseMod7Voice.MainPage.d__4.MoveNext()


And this is the code I'm trying to use:

private async void btnSpeak_Click(object sender, RoutedEventArgs e)
{
var recognizer = new SpeechRecognizerUI();
recognizer.Settings.ShowConfirmation = true;
recognizer.Settings.ReadoutEnabled = false;

try
{
var result = await recognizer.RecognizeWithUIAsync();
if (result.ResultStatus == SpeechRecognitionUIStatus.Succeeded)
{
MessageBox.Show(result.RecognitionResult.Text);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}


When I run the app and I click in the button to speak it displays a message confirmation for a few seconds and then disappears.

NOTE: I'm testing directly to my cellphone this app. (Nokia Lumia 920)

Answer Source

That error message means that the language isn't supported. I'm not sure what your language settings are but you can get the recognizer with your locale using this (swap en-GB with the culture you want)

var localRec = InstalledSpeechRecognizers.All
                       .Where(r => r.Language == "en-GB").FirstOrDefault();

Then set your recognizer with that language

if(localRec != null)
  recognizer.Recognizer.SetRecognizer(localRec);
else
  MessageBox.Show("Recognizer with the language not found");

If you don't explicitly set the locale above then the system will use the language set in the phone's Speech settings.