'Extensions.GetBotPerUserInConversationData <typet>(Message,string)'抛出异常

时间:2016-04-02 07:58:26

标签: c# bots .net-core botframework

在Microsoft Bot Framework教程中Get Started以下代码

        if (message.Type == "Message")
        {
            // fetch our state associated with a user in a conversation. If we don't have state, we get default(T)
            var counter = message.GetBotPerUserInConversationData<int>();

            // create a reply message   
            Message replyMessage = message.CreateReplyMessage($"{++counter} You said:{message.Text}");

            // save our new counter by adding it to the outgoing message
            replyMessage.SetBotPerUserInConversationData(counter);

            // return our reply to the user
            return replyMessage;
        }

有两个编译器错误

Error   CS7036  There is no argument given that corresponds to the required
formal parameter 'property' of   
'Extensions.GetBotPerUserInConversationData<TypeT>(Message, string)'

Error   CS7036  There is no argument given that corresponds to the required
formal parameter 'data' of  
'Extensions.SetBotPerUserInConversationData(Message, string, object)'   

是否有另一个扩展“Message”类的库?我无法在MSDN上找到参考或文档。

2 个答案:

答案 0 :(得分:2)

那些不是例外,那些是编译器错误。示例代码似乎已过时,文档也是如此 - 所有方法现在都需要property参数。只需对GetXXXSetXXX使用相同的值,就可以了。

答案 1 :(得分:2)

谢谢,你是对的,样本是错误的。我们很快会提供一个新的样本,显示用法,但同时@Luaan说得对。