System.TypeLoadException при попытке создать клиент Google Speech - PullRequest
0 голосов
/ 13 сентября 2018

Я пытаюсь создать экземпляр SpeechClient для использования Google Speech to Text API в приложении для Android на основе Xamarin.

//credentialStream is a valid memory stream of the contents of my JSON file
var credential = GoogleCredential.FromStream(credentialStream);
Channel channel = new Channel(SpeechClient.DefaultEndpoint.Host, 
    SpeechClient.DefaultEndpoint.Port, 
    credential.ToChannelCredentials());
var speech = SpeechClient.Create(channel);

Получение следующей ошибки:

{System.TypeLoadException: Could not resolve type with token 0100003b (from typeref, class/assembly System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
  at Grpc.Core.GrpcEnvironment.AddRef () [0x00000] in <0d847ba1eabc48c599d358afb3f4b250>:0 
  at Grpc.Core.Channel..ctor (System.String target, Grpc.Core.ChannelCredentials credentials, System.Collections.Generic.IEnumerable`1[T] options) [0x00051] in <0d847ba1eabc48c599d358afb3f4b250>:0 
  at Grpc.Core.Channel..ctor (System.String host, System.Int32 port, Grpc.Core.ChannelCredentials credentials, System.Collections.Generic.IEnumerable`1[T] options) [0x00012] in <0d847ba1eabc48c599d358afb3f4b250>:0 
  at Grpc.Core.Channel..ctor (System.String host, System.Int32 port, Grpc.Core.ChannelCredentials credentials) [0x00000] in <0d847ba1eabc48c599d358afb3f4b250>:0 
  at Stoq.Droid.Models.Microphone.test (System.IO.Stream credentialStream) [0x00009] in C:\Users\Wesley\source\repos\Stoq\Stoq\Stoq.Android\Models\Microphone.cs:36 }
...