SpeechSynthesizer shutdown process in linux without exceptions

Sebastiano Gazzola 1 Reputation point
2021-06-14T14:26:10.22+00:00

I have created a sample console app in dotnet core 5.0 that synthetize some text in italian, using Microsoft.CognitiveServices.Speech library. I can make it work in my Windows laptop and in a Ubuntu virtual machine, but if I try to run it in my Ubuntu server online, it exits without any exceptions. I can't really understand what the problem is, as I can't get any log message. Here the program:

using System;
using System.Threading.Tasks;
using Microsoft.CognitiveServices.Speech;

namespace text2speech_test
{
    class Program
    {
        static async Task Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            AppDomain.CurrentDomain.ProcessExit += CurrentDomainOnProcessExit;

            try{
                var text="ciao";

                var config = SpeechConfig.FromSubscription("20e436a07865468ba9b78a4aee703c07", "francecentral");
                config.SpeechRecognitionLanguage = "it-IT";
                config.SpeechSynthesisVoiceName = "it-IT-ElsaNeural";

                using var synthesizer = new SpeechSynthesizer(config, null);

                var result = await synthesizer.SpeakTextAsync(text);
                return;
            }
            catch(Exception ex){
                return;
            }
        }

        static void CurrentDomainOnProcessExit(object sender, EventArgs e){
            Console.WriteLine(e);
        }

        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Console.WriteLine("Terminating " + e.IsTerminating.ToString());
        }
    }
}

Can you help me on this?

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
Developer technologies | .NET | .NET Runtime
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
{count} votes

1 answer

Sort by: Most helpful
  1. Sebastiano Gazzola 1 Reputation point
    2021-06-23T06:40:05.893+00:00

    Sorry, I just saw your response. No, I didn't solve the problem, the code I posted is really all, it's already a working (and in my case, not working) sample of the azure api used in c#. Just I can't make it work on a Ubuntu Server on the cloud...


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.