dc.BeginDialogAsync:“值不能为空。\ n参数名称:选项”

时间:2019-06-12 00:00:26

标签: c# azure-bot-service

每次我运行await dc.BeginDialogAsync("sign-in");时,都会遇到此异常,这是没有意义的,因为其余参数是可选的。这让我超级困惑。这是我的代码:

public FlexoBot(ConversationState conversationState)
{
    this.dialogState = conversationState.CreateProperty<DialogState>("dialog-state");
    this.dialogs = new DialogSet(this.dialogState);

    // Make oauth card available to use for all handlers
    this.dialogs.Add(new OAuthPrompt("oauth", new OAuthPromptSettings() { ConnectionName = "flexo-auth" }));
    dialogs.Add(new WaterfallDialog("sign-in", new WaterfallStep[] {
        PromptSignIn,
        GreetUser,
    }));
}


protected override async Task OnMembersAddedAsync(IList<ChannelAccount> membersAdded, ITurnContext<IConversationUpdateActivity> turnContext, CancellationToken cancellationToken)
{
    var dc = await this.dialogs.CreateContextAsync(turnContext);
    foreach (var member in membersAdded)
    {
        if (member.Id != turnContext.Activity.Recipient.Id)
        {
            await dc.BeginDialogAsync("sign-in");
            // Throws: System.ArgumentNullException has been thrown "Value cannot be null.\nParameter name: options"
        }
    }
}

1 个答案:

答案 0 :(得分:0)

我终于明白了。这是因为我在瀑布步之一中打电话给"org.apache.spark" %% "spark-avro"。我将其更改为:

--packages org.apache.spark:spark-avro_2.12:2.4.3

它现在可以工作。