question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google.Cloud.Dialogflow.V2 Problem using the built in ToString.

See original GitHub issue

I have been using the Binding Redirect as explained in this website: https://codopia.wordpress.com/2017/07/21/how-to-fix-the-assembly-binding-redirect-problem-in-azure-functions/

But now I face this problem. Whenever I try to convert the WebhookRequest to string or the WebhookResponse to string so I can send back to Dialogflow the response. It gives me this error:

“Exception while executing function: Function1 -> The type initializer for ‘Google.Cloud.Dialogflow.V2.WebhookReflection’ threw an exception. -> The type initializer for ‘Google.Cloud.Dialogflow.V2.IntentReflection’ threw an exception. -> The type initializer for ‘Google.LongRunning.OperationsReflection’ threw an exception. -> Could not load file or assembly ‘Google.Api.CommonProtos, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47’ or one of its dependencies. The system cannot find the file specified. -> Could not load file or assembly ‘Google.Api.CommonProtos, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47’ or one of its dependencies. The system cannot find the file specified.”, “errorDetails”: “Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Function1 —> System.TypeInitializationException : The type initializer for ‘Google.Cloud.Dialogflow.V2.WebhookReflection’ threw an exception. —> System.TypeInitializationException : The type initializer for ‘Google.Cloud.Dialogflow.V2.IntentReflection’ threw an exception. —> System.TypeInitializationException : The type initializer for ‘Google.LongRunning.OperationsReflection’ threw an exception. —> System.IO.FileNotFoundException : Could not load file or assembly ‘Google.Api.CommonProtos, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47’ or one of its dependencies. The system cannot find the file specified. —> System.IO.FileNotFoundException : Could not load file or assembly ‘Google.Api.CommonProtos, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47’ or one of its dependencies. The system cannot find the file specified.\r\n at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)\r\n at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)\r\n at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,Evidence assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)\r\n at System.Reflection.Assembly.Load(AssemblyName assemblyRef)\r\n at Project.Helpers.AssemblyBindingRedirectHelper.<>c__DisplayClass2_0.<RedirectAssembly>b__0(Object sender,ResolveEventArgs args)\r\n at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly,String assemblyFullName) \r\n End of inner exception\r\n at Google.LongRunning.OperationsReflection…cctor() \r\n End of inner exception\r\n at Google.LongRunning.OperationsReflection.get_Descriptor()\r\n at Google.Cloud.Dialogflow.V2.IntentReflection…cctor() \r\n End of inner exception\r\n at Google.Cloud.Dialogflow.V2.IntentReflection.get_Descriptor()\r\n at Google.Cloud.Dialogflow.V2.WebhookReflection…cctor() \r\n End of inner exception\r\n at Google.Cloud.Dialogflow.V2.WebhookReflection.get_Descriptor()\r\n at Google.Cloud.Dialogflow.V2.WebhookRequest.get_Descriptor()\r\n at Google.Cloud.Dialogflow.V2.WebhookRequest.pb::Google.Protobuf.IMessage.get_Descriptor()\r\n at Google.Protobuf.JsonParser.Merge(IMessage message,JsonTokenizer tokenizer)\r\n at Google.Protobuf.JsonParser.Merge(IMessage message,TextReader jsonReader)\r\n at Google.Protobuf.MessageParser1.ParseJson(String json)\r\n at async Project.Function1.Run(HttpRequestMessage req,TraceWriter log)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker2.InvokeAsync[TReflected,TReturnValue](Object instance,Object[] arguments)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker invoker,ParameterHelper parameterHelper,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan timerInterval,IFunctionInstance instance)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,ParameterHelper parameterHelper,TraceWriter traceWriter,CancellationTokenSource functionCancellationTokenSource)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??) \r\n End of inner exception\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken)\r\n at Microsoft.Azure.WebJobs.Host.Executors.ExceptionDispatchInfoDelayedException.Throw()\r\n at async Microsoft.Azure.WebJobs.JobHost.CallAsync(??)\r\n at async Microsoft.Azure.WebJobs.Script.ScriptHost.CallAsync(String method,Dictionary2 arguments,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostManager.HandleRequestAsync(FunctionDescriptor function,HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.Host.FunctionRequestInvoker.ProcessRequestAsync(HttpRequestMessage request,CancellationToken cancellationToken,WebScriptHostManager scriptHostManager,WebHookReceiverManager webHookReceiverManager)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.<>c__DisplayClass3_0.<ExecuteAsync>b__0(??)\r\n at async Microsoft.Azure.WebJobs.Extensions.Http.HttpRequestManager.ProcessRequestAsync(HttpRequestMessage request,Func3 processRequestHandler,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.ExecuteAsync(HttpControllerContext controllerContext,CancellationToken cancellationToken)\r\n at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.WebScriptHostHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.SystemTraceHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)”

        [FunctionName("Function1")]
        public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log)
        {
            var requestString = await req.Content.ReadAsStringAsync();

            WebhookRequest request = WebhookRequest.Parser.ParseJson(requestString);

            var algo = request.ToString();

            ...

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
jskeetcommented, Aug 8, 2018

I hope that the underlying issue gets fixed by Microsoft at some point - I completely agree that it shouldn’t be this hard 😦

0reactions
jskeetcommented, Aug 10, 2018

Thanks very much for adding the comment - hopefully it’ll be useful to others who may be in the same boat.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dialogflow v2 client library not working | Error
The google auth library is looking for an environment variable called GOOGLE_APPLICATION_CREDENTIALS that points to a JSON credentials file.
Read more >
Google Cloud Dialogflow v2 API - Class SessionsClient ...
Processes a natural language query and returns structured, actionable data as a result. This method is not idempotent, because it may cause ...
Read more >
com.google.cloud.dialogflow.v2.SessionName.toString ...
How to use. toString. method. in. com.google.cloud.dialogflow.v2.SessionName ... newBuilder().build(); * Context response = contextsClient.
Read more >
Google Cloud Dialogflow ES
The Google Cloud Dialogflow modules enable you to monitor and respond to fulfillments, or create, update, retrieve, and delete agents, contexts, entities, ...
Read more >
How to Setup DialogFlow V2 Authentication Programmatically ...
First, you need to download the key json file into your computer from google cloud console. One simple solution is to export the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found