From 434c1c8aee89896e8111987c13d638755bca217a Mon Sep 17 00:00:00 2001 From: sw-joelmut Date: Tue, 14 Jun 2022 14:50:23 -0300 Subject: [PATCH] Add dynamic dialog loading on ContinueActions --- .../AdaptiveDialog.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs index d584a2c241..8b745eeebc 100644 --- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs +++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs @@ -16,6 +16,7 @@ using Microsoft.Bot.Builder.Dialogs.Adaptive.Recognizers; using Microsoft.Bot.Builder.Dialogs.Adaptive.Selectors; using Microsoft.Bot.Builder.Dialogs.Debugging; +using Microsoft.Bot.Builder.Dialogs.Declarative.Resources; using Microsoft.Bot.Schema; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -677,6 +678,20 @@ protected async Task ContinueActionsAsync(DialogContext dc, ob var actionDC = CreateChildContext(actionContext); while (actionDC != null) { + if (actionDC.ActiveDialog != null) + { + var dialog = FindDialog(actionDC.ActiveDialog.Id); + if (dialog == null) + { + var resourceExplorer = actionDC.Context.TurnState.Get(); + if (resourceExplorer != null) + { + dialog = resourceExplorer.LoadType($"{actionDC.ActiveDialog.Id}.dialog"); + actionDC.Dialogs.Add(dialog); + } + } + } + // DEBUG: To debug step execution set a breakpoint on line below and add a watch // statement for actionContext.Actions. DialogTurnResult result;