I have a bot built with C# / MS Bot Framework which runs on Azure. It works normally, but HTTP logs in Azure show a large number of failed HTTP requests, about 20% of total.
When I enabled failed request tracing, that's what I saw in the logs:
URL: /api/messages
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace
[InvalidOperationException: An asynchronous module or handler completed while an asynchronous operation was still pending.]
I could not extract any more details from the logs, including the stack trace (it is empty).
The bot also works normally in the emulator. The failed requests appear when talking to the bot through Facebook, even though the user can interact with the bot normally despite the seemingly failed requests.
I can't figure out which part of the code might even cause this and my other bots do not seem to have this issue.
I suspect it could be that I'm using context.Done(this)
to terminate a dialog, but this seems to be a normal practice to use this.
Any pointers or ideas which part of the code might cause this, or how to extract more details about the error, will be appreciated. Thanks.