Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResumeDialogAsync of Parent not firing #6472

Open
giobb opened this issue Feb 21, 2022 · 3 comments
Open

ResumeDialogAsync of Parent not firing #6472

giobb opened this issue Feb 21, 2022 · 3 comments
Labels
bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team.

Comments

@giobb
Copy link

giobb commented Feb 21, 2022

Version

4.15.2

Hi everyone. I have the same experience as the 3 stack overflow posters below. The EndDialogAsync documentation clearly states that the ResumeDialogAsync of the parent will fire after the child calls the EndDialogAsync. As one of the posters below asked, are we really missing something here?

https://stackoverflow.com/questions/55190353/bot-framework-resumedialogasync-not-firing
https://stackoverflow.com/questions/58236708/resumedialogasync-on-microsoft-botframework-doesnt-fire
https://stackoverflow.com/questions/59650364/when-calling-enddialogasync-on-child-dialog-resumedialogasync-doesnt-get-calle

@giobb giobb added bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team. labels Feb 21, 2022
@breenbob
Copy link

I'm also having this issue. Still persists in the latest 4.22.3 released 7 days ago.

Any plans to address the issue? Any suggestions for workarounds for this?

@breenbob
Copy link

breenbob commented Apr 22, 2024

Also, something weird in the documentation here:

The parent dialog is the dialog the started the on being ended via a call to either BeginDialogAsync(String, Object, CancellationToken) or PromptAsync(String, PromptOptions, CancellationToken).

@breenbob
Copy link

breenbob commented Apr 22, 2024

OK, think I have figured out the cause of the problem, for me at least.

My circumstance was a WaterfallDialog being shown inside a ComponentDialog, used to add other dialog types such as TextPrompt, AttachmentPrompt etc.

I luckily had verbose logging enabled, and noticed the Bot framework was logging the flow it was following to the output window. When I tried to end my child waterfall dialog, I was seeing log output like the below:

'message' ==> EndDialog ==> TextPrompt
'message' ==> ResumeDialog ==> ChildWaterfallDialog
'message' ==> EndDialog ==> ChildWaterfallDialog
'message' ==> EndDialog ==> ChildComponentDialog
'message' ==> ResumeDialog ==> TextPrompt

I would have expected ResumeDialog to be called on my Parent Waterfall Dialog. But it shows a TextPrompt instead. I quickly realised this is because I send 2 text prompts back in the active step of the parent dialog before beginning the child dialog.

I tried inspecting the Stack on the parent dialog before I begin the child dialog, and sure enough, the two TextPrompts are the last items in the stack, after my Parent waterfall dialog.

First I tried manipulating the stack:

  1. with stepContext.Stack.Clear() - that removed my parent waterfall too which ended all dialogs when the child completed.
  2. in a for loop in reverse order, to pop only items where the Id doesn't match my parent waterfall dialog - this didn't seem to be properly persisted after a postback, which was weird.
  3. I tried calling EndDialogAsync in the for loop instead, thinking this will properly dispose of my 2 text prompts. This caused a turn error.

Finally I realised that to keep it clean, those text prompts really belong inside the first step of the child waterfall dialog. When I moved them inside it instead, I ended up with the same flow (as far as the end user is concerned), but when EndDialogAsync is called in the child waterfall dialog, it finally called the next step of my parent waterfall model with the child waterfall dialog result passed in as stepContext.Result (without the need to override ResumeDialogAsync, as the documentation suggests).

Debatable whether this is incorrect behaviour, or incorrect/poor documentation. One would expect the parent dialog to be the dialog that called BeginDialogAsync to create the child. Documentation doesn't say anything to the contrary. Either way, given this issue posted 2+ years ago, I have concerns about this product.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team.
Projects
None yet
Development

No branches or pull requests

2 participants