I am using Bot Framework SDK v-4.x based on .Net Core. I have couple of dialogs created which I am able to flow through using DialogContext.Begin
, DialogContext.End
and DialogContext.Continue
. Everything works fine, but now I want to implement a FormFlow in the middle of a conversation. I referred this link- https://docs.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-formflow?view=azure-bot-service-3.0
I posted this on Github (https://github.com/MicrosoftDocs/bot-docs/issues/227) and based on the solution this is what I tried-
[Serializable]
public class HelpForm
{
public string FullName { get; set; }
public string EmailID { get; set; }
public string Question { get; set; }
public DateTime BestTimeToContact { get; set; }
public List<Priority> Priority { get; set; }
public static IForm<HelpForm> BuildForm()
{
return new FormBuilder<HelpForm>()
.Message("Please fill out the details as prompted.")
.Build();
}
}
public enum Priority
{
Low,
Medium,
High
}
In my OnTurn
event of my bot, I am doing something like this-
await Microsoft.Bot.Builder.Classic.Dialogs.Conversation.SendAsync(context, () => FormDialog.FromForm(HelpForm.BuildForm)); //context is of type ITurnContext
This doesn't seem to work and I get a response in the emulator as
Sorry, my bot code is having an issue.
Also, this link- https://github.com/Microsoft/botbuilder-dotnet/wiki/Using-Classic-V3-Dialogs-with-V4-SDK says that Microsoft.Bot.Builder.Classic
is not supported in .Net Core.
Any help with this please?
Update
Based on Fei's comment, I got the exception details. System.Runtime.Serialization.SerializationException: Type 'System.RuntimeType' in Assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' is not marked as serializable.
. Although my HelpForm class is marked with Serializable
.
Looking at the metadata for FormFlow
class it is not marked with Serializable
attribute.
Note sure if that is what the error is about.
Sorry, my bot code is having an issue.
You can try to trace/check the detailed exception message via CatchExceptionMiddleware. – Fei HanSystem.Runtime.Serialization.SerializationException: Type 'System.RuntimeType' in Assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' is not marked as serializable.
. Although myHelpForm
class is marked withSerializable
. – Souvik Ghosh