Kah
Kah

Reputation: 647

Null botId - Microsoft Bot Framework SDK V3

I am trying to locally run the EchoBot example of the MS Bot Framework, following the updates to SDK V3, and am unable to create a dialog.

At the call to

Conversation.SendAsync(activity, () => EchoChainDialog.dialog);

The error I get is

System.ArgumentNullException occurred
  HResult=-2147467261
  Message=Value cannot be null.
Parameter name: botId
  ParamName=botId
  Source=Microsoft.Bot.Builder
  StackTrace:
       at Microsoft.Bot.Builder.Internals.Fibers.SetField.CheckNull[T](String name, T value)
  InnerException: 

I'm wondering what the null botID means. I'm running the app locally, following the Getting Started tutorial. It says that don't need to supply an AppID for the bot, and I'm fairly certain AppId and botId aren't the same thing. I can't seem to find much documentation on what this botId field is.

Has anyone else experienced this issue? Is the only way around this registering the bot and providing an AppId?

Upvotes: 2

Views: 1137

Answers (2)

Maarten
Maarten

Reputation: 1951

It needs to be in web.config or app.config

<appSettings>
  <add key="BotId" value="[Your Id]" />
  <add key="MicrosoftAppId" value="[The app id]" />
  <add key="MicrosoftAppPassword" value="[The client secret]" />
</appSettings>

The autofac magic in BotBuilder picks it up from there, and only from there.

I tried setting it in some other way because I want to use the new json style configuration, but have not been successful so far. I guess there must be some way, it is possible to implement an IBotIdResolver, which I tried, but it seems to require lots more customization, I could not make the Conversation class pick up my implementation.

Upvotes: 1

Kah
Kah

Reputation: 647

Apparently you can do

ConfigurationManager.AppSettings["BotId"] = "test";

And it will work. I'm not sure what is supposed to set the "BotId" field, but if you're running into this issue and just need test locally, adding this line in MessagesController.cs before a call to Conversation.SendAsync is a workaround.

Upvotes: 2

Related Questions