0

I am using SpeechtoText Google API in my C# desktop application. I am trying to authenticate using json file (containing project ID and account ID etc.). When I run the code in Visual studio, it works fine but when I run a standalone installation of the same project on the same computer, the channel creation line takes forever. Probably I am missing something. Can someone please help me out?

For example, in the code snippet below, the program gets stuck in line 2.

P.S. I have tried other ways too, like creating speech client without channel and etc. Then the program stucks in SpeechClient.create().

C# Code:

var credential = GoogleCredential.FromFile(cred_filepath_var).CreateScoped(SpeechClient.DefaultScopes);
var channel = new Grpc.Core.Channel(SpeechClient.DefaultEndpoint.ToString(), credential.ToChannelCredentials());
var speech = SpeechClient.Create(channel);
  • as a general tip, have you tried enabling extra logging by following https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md – Jan Tattermusch Oct 04 '18 at 15:40
  • 1
    Are you certain that it's getting stuck rather than throwing an exception? It's odd if the same code is running fine in Visual Studio... can you reproduce this with a trivial console application? – Jon Skeet Oct 04 '18 at 15:52

1 Answers1

0

I had the same problem, and it wasn't waiting forever, the real problem is that I was invoking it from a Task without try-catch block, so the error was not visible. After surrounding the code with a try-catch block, I found that there was a missing native reference: "grpc_csharp_ext.x64.dll". Copying that library to the program folder fixed the issue.

Ernesto
  • 439
  • 4
  • 12