Google.Cloud.Dialogflow.V2 Problem using the built in ToString.
See original GitHub issueI 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.MessageParser
1.ParseJson(String json)\r\n at async Project.Function1.Run(HttpRequestMessage req,TraceWriter log)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker
2.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,Func
3 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:
- Created 5 years ago
- Comments:7
I hope that the underlying issue gets fixed by Microsoft at some point - I completely agree that it shouldn’t be this hard 😦
Thanks very much for adding the comment - hopefully it’ll be useful to others who may be in the same boat.