Botframework-sdk: My bot throws "412" errors after updating to version 3.5.3

Created on 25 Feb 2017  路  8Comments  路  Source: microsoft/botframework-sdk

I had this code to correct this errors in the version 3.3.3:

protected void Application_Start()
       {
             var builder = new ContainerBuilder();
           builder
               .Register(c => new CachingBotDataStore(c.Resolve<ConnectorStore>(), CachingBotDataStoreConsistencyPolicy.LastWriteWins))
               .As<IBotDataStore<BotData>>()
               .AsSelf()
               .InstancePerLifetimeScope();
           builder.Update(Conversation.Container);

           GlobalConfiguration.Configure(WebApiConfig.Register);
       }

It was in the static builder of the messagesController
But if doesn't work anymore, it throws an exception

Most helpful comment

The registration of ConnectorStore has changed:

https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Library/Microsoft.Bot.Builder.Autofac/Dialogs/DialogModule.cs#L140

You might change the c.Resolve<ConnectorStore>() in the above code to c.ResolveKeyed<IBotDataStore<BotData>>(typeof(ConnectorStore))

All 8 comments

What exception does it throw?

I have the same issue. Was using 3.5.1 and everything worked. Updated to 3.5.3 in order to use the newest AuthBot and the bot stopped answering. In my case it is a 500 Server Error.

"Exception thrown: 'System.TypeInitializationException' in BotName.dll"

If I revert back to 5.3.1 it works again. Any clues?

Thanks!

@willportnoy it throws: Autofac.Core.Registration.ComponentNotRegisteredException, The requested service 'Microsoft.Bot.Builder.Dialogs.Internals.ConnectorStore' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.

The registration of ConnectorStore has changed:

https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Library/Microsoft.Bot.Builder.Autofac/Dialogs/DialogModule.cs#L140

You might change the c.Resolve<ConnectorStore>() in the above code to c.ResolveKeyed<IBotDataStore<BotData>>(typeof(ConnectorStore))

@willportnoy That worked, thanks!

@willportnoy your last comment is important as the documentation is not up-to-date on page https://docs.microsoft.com/en-us/bot-framework/troubleshoot-general-problems

@willportnoy Hi, I changed the code as you suggested. There is no exception thrown, but my context object does not work. I get the data from the context is null. Any advice?

@298029lkk This is a closed issue. Please create a new issue, or ask a question on Stack Overflow.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peterbozso picture peterbozso  路  3Comments

hailiang-wang picture hailiang-wang  路  3Comments

kenyeung128 picture kenyeung128  路  3Comments

stijnherreman picture stijnherreman  路  3Comments

vaditya04 picture vaditya04  路  3Comments