0

I am having an issue with my .NET WPF application freezing when using Azure Text-to-Speech services.

From debugging it seems the SpeakTextAsync synthesizes the text I send, but never completes/returns a value, causing the application to be unresponsive.

I have experience with Java and some web technologies but I am fairly new to C#, .NET and Azure.

I have a sample app here to highlight the issue I am having; perhaps if anyone has any ideas they can give me some tips on debugging in the future :)

For the sample app to work, replace line 12 of SpeechSample.UI/SpeechSample.Services/SpeechService.cs with your Azure subscription key.

Thanks for your time.

Stephen Stewart
  • 169
  • 3
  • 8
  • 1
    While it is great that you posted a complete solution, please copy the relevant part of your code (which is not working) and paste it here. – Gaurav Mantri Jul 13 '21 at 15:11

1 Answers1

2

I updated my sample app with the fix. I was running the initial async task TriggerEventAsync wrong

//Switched this line
TriggerEventAsync(eventManager).GetAwaiter().GetResult();

//For this line
Task.Run(async () => await TriggerEventAsync(eventManager));
Stephen Stewart
  • 169
  • 3
  • 8