diff --git a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillDialog.cs b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillDialog.cs
index d3f20f5484..d93d309d42 100644
--- a/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillDialog.cs
+++ b/lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillDialog.cs
@@ -44,11 +44,12 @@ public class SkillDialog : ComponentDialog
/// Proactive State.
/// Endpoint Service.
/// Telemetry Client.
- /// Background Task Queue.
- /// Use Cached Tokens.
+ /// UserState.
+ /// Auth Dialog.
public SkillDialog(SkillManifest skillManifest, ResponseManager responseManager, MicrosoftAppCredentialsEx microsoftAppCredentialsEx, IBotTelemetryClient telemetryClient, UserState userState, MultiProviderAuthDialog authDialog = null)
: base(skillManifest.Id)
{
+
_skillManifest = skillManifest;
_microsoftAppCredentialsEx = microsoftAppCredentialsEx;
_telemetryClient = telemetryClient;
@@ -70,6 +71,12 @@ public SkillDialog(SkillManifest skillManifest, ResponseManager responseManager,
/// dialog turn result.
protected override async Task OnBeginDialogAsync(DialogContext innerDc, object options, CancellationToken cancellationToken = default(CancellationToken))
{
+ Dictionary slotsToPass = new Dictionary();
+
+ // Retrieve the SkillContext state object to identify slots (parameters) that can be used to slot-fill when invoking the skill
+ var accessor = _userState.CreateProperty(nameof(SkillContext));
+ var skillContext = await accessor.GetAsync(innerDc.Context, () => new SkillContext());
+
var actionName = options as string;
if (actionName == null)
{
@@ -77,35 +84,28 @@ public SkillDialog(SkillManifest skillManifest, ResponseManager responseManager,
}
else
{
+ // Find the Action within the selected Skill for slot filling evaluation
_action = _skillManifest.Actions.Single(a => a.Id == actionName);
- if (_action == null)
+ if (_action != null)
{
- throw new ArgumentException($"Passed Action ({actionName}) could not be found within the {_skillManifest.Id} skill manifest action definition.");
- }
- }
-
- // Retrieve the SkillContext state object to identify slots (parameters) that can be used
- // to slot-fill when invoking the skill
- var accessor = _userState.CreateProperty(nameof(SkillContext));
- var skillContext = await accessor.GetAsync(innerDc.Context, () => new SkillContext());
-
- Dictionary slotsToPass = new Dictionary();
-
- // If we don't have any state then we skip Slot filling
- if (skillContext != null && skillContext.Count > 0)
- {
- // Do we have slots?
- if (_action != null && _action.Definition.Slots != null)
- {
- // For each slot we check to see if there is an exact match, if so we pass this slot across to the skill
- foreach (Slot slot in _action.Definition.Slots)
+ // If the action doesn't define any Slots or SkillContext is empty then we skip slot evaluation
+ if (_action.Definition.Slots != null && skillContext.Count > 0)
{
- if (skillContext.TryGetValue(slot.Name, out object slotValue))
+ foreach (Slot slot in _action.Definition.Slots)
{
- slotsToPass.Add(slot.Name, slotValue);
+ // For each slot we check to see if there is an exact match, if so we pass this slot across to the skill
+ if (skillContext.TryGetValue(slot.Name, out object slotValue))
+ {
+ slotsToPass.Add(slot.Name, slotValue);
+ }
}
}
}
+ else
+ {
+ // Loosening checks for current Dispatch evaluation, TODO - Review
+ //throw new ArgumentException($"Passed Action ({actionName}) could not be found within the {_skillManifest.Id} skill manifest action definition.");
+ }
}
var activity = innerDc.Context.Activity;