botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Update 3.13.0.3 breaks FormFlow .Field using enum

Open MNHarun opened this issue 8 years ago • 6 comments

Bot Info

  • SDK Platform: .NET
  • SDK Version: 3.12.2.4
  • Active Channels: None
  • Deployment Environment: Local development with Emulator

Issue Description

I'm doing simple FormFlow with just 3 input and save responses to UserData (stored using local CosmosDB simulator). First input is from enum (Yes or No), indicating whether to proceed or not. The other two are strings and SetActive depending on the first input button selection. The first input is not saved to UserData, only the two strings are saved.

Update to 3.13.0.3. Start debug and cannot even start the conversation, 500 Internal Server Error. I delete botdb database in the CosmosDB simulator and I can start conversation. Now the and button appears but nothing happen when clicked. Normally, when I click on Yes, its as though I responded with Yes. When nothing happen with click, I typed Yes (and also tried number 1) and the conversation continues.

Now, running 3.13.0.3. all choices from enum not working.

One more, UserData created using 3.12.2.4 is not compatible with 3.13.0.3?

Code Example (with issue)

public enum AddOfficial { Yes = 1, No = 2 }

[Serializable]
public class OfficialInfo
{
    public TextLabels.AddOfficial? AskAddOfficial { get; set; }
    public string OfficialName { get; set; }
    public string OfficialID { get; set; }

    public static IForm<OfficialInfo> BuildForm()
    {
        return new FormBuilder<OfficialInfo>()
            .Field(new FieldReflector<OfficialInfo>(nameof(AskAddOfficial))
                .SetPrompt(new PromptAttribute(TextLabels.PromptSetOfficialPersonalNFOAsk + "{||}"))
                .SetFieldDescription(new DescribeAttribute(TextLabels.DescribeSetOfficialPersonalNFOAsk))
                .SetActive(x => true)
                .SetNext((value, x) =>
                {
                    if (x.AskAddOfficial.Value == TextLabels.AddOfficial.Yes)
                    {
                        return new NextStep(new[] { nameof(OfficialName) });
                    }
                    else if (x.AskAddOfficial.Value == TextLabels.AddOfficial.No) { return new NextStep(); }
                    else { return new NextStep(new[] { nameof(AskAddOfficial) }); }
                }))

            .Field(new FieldReflector<OfficialInfo>(nameof(OfficialName))
                .SetPrompt(new PromptAttribute(TextLabels.PromptSetPersonalNFOOfficialName))
                .SetFieldDescription(new DescribeAttribute(TextLabels.DescribeSetPersonalNFOOfficialName))
                .SetActive(x => !x.AskAddOfficial.HasValue || x.AskAddOfficial == TextLabels.AddOfficial.Yes)
                )

            .Field(new FieldReflector<OfficialInfo>(nameof(OfficialID))
                .SetPrompt(new PromptAttribute(TextLabels.PromptSetPersonalNFOOfficialID))
                .SetFieldDescription(new DescribeAttribute(TextLabels.DescribeSetPersonalNFOOfficialID))
                .SetActive(x => !x.AskAddOfficial.HasValue || x.AskAddOfficial == TextLabels.AddOfficial.Yes)
                )

        //.OnCompletion(SaveUserData)
        .Build();
    }
}

MNHarun avatar Jan 31 '18 11:01 MNHarun

Yes, v3.13.0.3 broke form flow. It's not only specific to enums.

ghost avatar Feb 05 '18 08:02 ghost

Could this also result in other phenomena? After upgrading to 3.13.0.3 I experienced the problem described here (yes/no buttons no longer clickable) in Webchat, but on the same dialogs I am now also experiencing crashes on the Facebook connector. Is this related?

tiloc avatar Feb 05 '18 14:02 tiloc

@tiloc I think so.

https://github.com/Microsoft/BotBuilder/compare/[email protected]#diff-22d3aafad398bb6777ae1c317a342eedL41

         /// </summary>
         public CardAction()
         {
-            this.Type = ActionTypes.ImBack;
+            CustomInit();
         }

-        /// The type of action implemented by this button. Defaults to <see cref="ActionTypes.ImBack"/>
+        /// An initialization method that performs custom operations like setting defaults
+        /// </summary>
+        partial void CustomInit();

ghost avatar Feb 05 '18 14:02 ghost

I upgraded the nuget package to 3.13.1 and everything is back to normal. Yes/No is clickable in Web Chat and Facebook Messenger behaves again as desired.

tiloc avatar Feb 07 '18 13:02 tiloc

@tiloc glad to hear that!

ghost avatar Feb 07 '18 17:02 ghost

Well done 😊. Thank you.

MNHarun avatar Feb 07 '18 17:02 MNHarun