Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit 36dfddb

Browse files
authored
[Lib] Skill Middleware update to clear conv state when skill is cancelled (#2441)
* Added fix to clear conversatoin state when skill is cancelled. * Refactor Samples directories (#2437) * Move analytics to /docs/assets and update the Power BI doc with a download button * Move Android apps to /android/clients Deprecate the csharp simple speech app (replacing with kona client) Deprecrate the typescript webchat * Refactors assistants to /samples/csharp/assistants/EnterpriseAssistant.sln /samples/charp/assistants/HospitalityAssistant.sln Added build.props and .ruleset files to both * Move all csharp clients to a single solution. Rename assistant-ConsoleDirectLineSample to DirectLine.Web Rename assistant-WebTest to WebChatWithLinkedAccounts.Web Add. build.props and .ruleset * Update README.md * Refactor Skill directories (#2435) * Skills: Remove src directory Move all tests to /skills/csharp/tests Rename all test projects as {SkillName}Tests Move Phone & Automotive Skill projects at same level as other experimentals * Update test namespaces to {Skill}.Tests Update TestBases to {Skill}TestBase * Fix ruleset reference * Reorder usings * Fix tabe spacings * Rename tests directories to match project names * Refactor Libraries directories to SDK format (#2436) * Rename /libs to /libraries to match SDK Rename libraries solution to Microsoft.Bot.Builder.Solutions Extract test projects to /tests directories * Fix .snk file references * Update to: \sdk \csharp \build \libraries \microsoft.bot.builder.skills \microsoft.bot.builder.solutions \tests \microsoft.bot.builder.skills.tests \microsoft.bot.builder.solutions.tests Microsoft.Bot.Builder.Solutions.sln * Rename microsoft.bot.builder.skills to microsoft.bot.builder.solutions.skills Refactor typescript libraries to follow \sdk \typescript \libraries \botbuilder-skills \botbuilder-solutions Move .ps1 files to \build and update references within Update yaml files with new references (csharp and typescript) Remove VirtualAssistant.ruleset at root * Updated npm pack references from \build\outputpackages directory * Fix reference to Skills project in solution Rename Skills test folder to Microsoft.Bot.Builder.Solutions.Skills.Tests * Match botbuilder.solutions.skills.yml to new directory * Remove .snk file from /build directory as it is duplicated in /sdk/csharp/build * Move \yaml as subdirectory under \build * Fix ref to microsoft.bot.builder.solutions.skills directory * skill fixes (#2449) * POI: align tests to code, update lu * Bing search: add locale to GetSearchResult, update lu * Added fix to clear conversatoin state when skill is cancelled. * changed to clear conv state instead of delete
1 parent d6825be commit 36dfddb

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

sdk/csharp/libraries/microsoft.bot.builder.solutions.skills/SkillMiddleware.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,9 @@ public SkillMiddleware(UserState userState, ConversationState conversationState,
2929
{
3030
if (activity.Name == SkillEvents.CancelAllSkillDialogsEventName)
3131
{
32-
// when skill receives a CancelAllSkillDialogsEvent, clear the dialog stack and short-circuit
33-
var currentConversation = await _dialogState.GetAsync(turnContext, () => new DialogState());
34-
if (currentConversation.DialogStack != null)
35-
{
36-
currentConversation.DialogStack.Clear();
37-
await _dialogState.SetAsync(turnContext, currentConversation);
38-
await _conversationState.SaveChangesAsync(turnContext, true);
39-
}
40-
32+
await _dialogState.DeleteAsync(turnContext).ConfigureAwait(false);
33+
await _conversationState.ClearStateAsync(turnContext).ConfigureAwait(false);
34+
await _conversationState.SaveChangesAsync(turnContext, force: true).ConfigureAwait(false);
4135
return;
4236
}
4337
}

0 commit comments

Comments
 (0)