直列化可能ではありません。匿名メソッドの閉鎖は、私は次のエラーを取得しています
助けてください。
マイコード:
Ensure that all dialogs are serializable. This can be as simple as using the [Serializable] attribute on your IDialog implementations. However, be aware that anonymous method closures are not serializable if they reference their outside environment to capture variables. The Bot Framework supports a reflection-based serialization surrogate to help serialize types that are not marked as serializable.
あなたは交換する必要があります:匿名メソッドは、直列化可能でないとdocsごとにあなたはすべてのダイアログを確認する必要があり、シリアライズされているので、これが期待されている
public enum SystemSelection { SharePoint, BizTalk, Azure, Office365 };
public enum RequestType { Bug, SupportRequest, Question };
public enum Importance { Blocking, High, Medium, Low };
[Serializable]
class Declaration
{
public string Type;
public string Amount;
public string Date;
public static IForm<Declaration> BuildForm()
{
return new FormBuilder<Declaration>()
.Message("Add a declaration")
.Build();
}
}
[Serializable]
class SupportRequest
{
public SystemSelection? SystemSelection;
public RequestType? RequestType;
public Importance? Importance;
public Declaration Declaration;
public static IForm<SupportRequest> BuildForm()
{
return new FormBuilder<SupportRequest>()
.Message("Welcome to the simple support bot!")
.AddRemainingFields()
.Build();
}
internal static IDialog<SupportRequest> MakeRootDialog3()
{
SupportRequest t = null;
var dlg = Chain.ContinueWith(FormDialog.FromForm(SupportRequest.BuildForm),
async (context, res) =>
{
t = await res;
return Chain.ContinueWith<Declaration, SupportRequest>(FormDialog.FromForm(Declaration.BuildForm),
async (context2, res2) =>
{
t.Declaration = await res2;
return Chain.Return(t);
});
});
return dlg;
}
}