I am working on a bot in .NET. I have a scorable from which I would like to start the D1 dialog, and then get an empty stack. Or, to put it another way, I want to start a new dialog, but instead of interrupting the one I was in (for example, the most crafty examples), the empty stack of the dialog box ends (for example, cancel the cancellation example).
Perhaps a relevant point: the dialog that it launches (D1) alternately pushes another dialog box (D2) onto the stack, which I also want to work correctly before the stack clears.
Here is an example to undo: scaable: https://docs.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-global-handlers . Its purpose is to clear the stack of the dialog box.
I would like to do this, but will bring up another dialogue first. I tried this in my scorable's PostAsync () method:
var interruption = dialog_D1.Void<object, IMessageActivity>(); _task.Call(interruption, null); await _task.PollAsync(token); _task.Reset();
However, what happens is that PollAsync () fires, and the dialogue stack is cleared as soon as D1 calls D2. This means that when you respond to D2, the stack is empty and RootDialog accepts the input.
I also tried this in my scorable's PostAsync () method:
var interruption = dialog_D1.Void<object, IMessageActivity>(); _task.Call(interruption, AfterCallingDialog); await _task.PollAsync(token); ... private async Task AfterCallingDialog(IDialogContext context, IAwaitable<object> result) { _task.Reset(); }
But in this case, the bot errors with "execution of the IDialog method are completed with several resume handlers specified using IDialogStack". as soon as he presses _task.Call ()
Can anyone suggest a fix for this or let me know about a different approach?
Thanks!
Lee