I've recently deployed a bot for many users. Sometimes when I call EndDialogAsync()
I get a BadRequest error.
Here's my stack trace:
Microsoft.Bot.Schema.ErrorResponseException
Operation returned an invalid status code 'BadRequest'
Bot.CustomPrompts.CustomPrompt in OnPromptAsync at line 37:17 within BasicBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Called from: System.Runtime.ExceptionServices.ExceptionDispatchInfo in Throw within System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
Bot.Dialogs.Tour.TourDialog+<>c__DisplayClass0_0+<<-ctor>b__10>d in MoveNext at line 512:17 within BasicBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Called from: System.Runtime.ExceptionServices.ExceptionDispatchInfo in Throw within System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
Line 512 of TourDialog is:
return await stepContext.EndDialogAsync();
And Line 37 of CustomPrompt is:
await turnContext.SendActivityAsync(options.Prompt, cancellationToken).ConfigureAwait(false);
It seems like the dialog is being ended and so the stepContext should no longer exists. CustomPrompt is a custom class for realizing AdaptivePrompts within botframework v4 (found here Adaptive Card response from a WaterfallStep Dialog MS Bot framework v4). I don't know why CustomPrompt is being called at all because the dialog should have ended.