WebhookReflection Error when parsing webhook request in ASP.NET WebApi #3445
Labels
status: blocked
Resolving the issue is dependent on other work.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Hello,
we are testing the Dialogflow Standard edition in order to make a simple chatbot that will communicate with a webhook in a ASP.NET website.
The chatbot is working but we have a problem with the c# code to parse the webhook request.
We have built the webhook following the specification and the c# library but we still getting an error when trying to parse the request body into a WebhookRequest object from Google.Cloud.Dialogflow.V2 library.
The problem is when we try to parse the json using the Google.Protobuf. JsonParser object instantiated like this example here: https://googleapis.github.io/google-cloud-dotnet/docs/Google.Cloud.Dialogflow.V2/index.html#web-hook-template-code-for-aspnet-classic-web-api
The request sent by Dialogflow is the following:
We have tryied many times with different solution (also with Newtonsoft Json).
In our code we are getting this error:
The type initializer for 'Google.Cloud.Dialogflow.V2.WebhookReflection' threw an exception.
At this line of code: var request = jsonParser.Parse(json);
Here you can see a screen of our code with the jsonParser instantiated

All the packages and dependencies were downloaded by NuGet package manager like the suggest in the guide here: https://cloud.google.com/dialogflow/docs/quick/setup#lib
Here you can see all the packages versions:
Here you can also find the complete stacktrace of the error.
error.txt
Seems that the error occur when the parser is trying to parse the WebhookRequest message descriptor and somewhere it fails with an System.IndexOutOfRangeException
Can you please help us to find and fix the problems? Is this error related to a specific release of the Google.Cloud.Dialogflow.V2 or Protobuf libraries?
The text was updated successfully, but these errors were encountered: