Search code examples
c#botframeworkbots

Installed MS Virtual Assistant on MS Teams causes issue when chaging project structure


We have a previously working ms bot installed on ms teams. The project is respectively growing and we decided to re-structure the project, including renaming the projects relatively to each purpose (Core, Models, Services, States, etc ...)

We unit tested everything and worked well locally. Then we published it and then tested with the web chat, changes works with no issues. But somehow, when we tested in our MS Teams, and suddenly we are getting this error

Error resolving type specified in JSON 'SomeProject.OldProjectName.Object'

What is more bizzare is that this happens on a 1-1 chat with the bot, but does not happen when the bot is chatted within a team/group.

Its affected the clients using it, and we we're forced to revert back to our previous working version until we have it cleared and figured out why it happens.

Any ideas are much appreciated.


Solution

  • I got it working, it was just as simple as it gets. You only have to cleanup some of your cosmos db items. Deleting entries starting with msteams* did the trick.

    What happened was it was trying to match the current state against the state that was saved on cosmos db. When it did not matched, it thrown an error. Removing the entries solved the issue. The bot will just add a new state into the cosmos db.

    So whenever you have breaking changes to your class that handles the bot state, you will have to cleanup the cosmos db, so it won't cause you some trouble.