Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Conversation

@mdrichardson
Copy link
Contributor

@mdrichardson mdrichardson commented Sep 6, 2019

Fixes: #2480

Issue

BotframeworkAdapter.CreateConversation strips out the ChannelData of the message here. As you can see per linked issue, this can cause problems when using CreateConversation with Teams since Teams requires TenantId on the ChannelData.

I also fixed up an issue where MockAdapter.CreateConversation wasn't mimicking our actual code, which would have caught this issue earlier.

Changes

BotFrameworkAdapter.cs

- eventActivity.Conversation = new ConversationAccount(id: result.Id);
+ eventActivity.Conversation = new ConversationAccount(id: result.Id, tenantId: conversationParameters.TenantId);
+ eventActivity.ChannelData = conversationParameters.ChannelData;

MockAdapter

- var activity = conversationParameters.Activity;
- activity.ChannelData = new
- {
- 	conversationParameters.TenantId,
- };
+ // Create a conversation update activity to represent the result.
+ var eventActivity = Activity.CreateEventActivity();
+ eventActivity.Name = "CreateConversation";
+ eventActivity.ChannelId = channelId;
+ eventActivity.ServiceUrl = serviceUrl;
+ eventActivity.Id = conversationParameters.Activity.Id ?? Guid.NewGuid().ToString("n");
+ eventActivity.Conversation = new ConversationAccount(id: Guid.NewGuid().ToString(), tenantId: conversationParameters.TenantId);
+ eventActivity.ChannelData = conversationParameters.ChannelData;
+ eventActivity.Recipient = conversationParameters.Bot;

Testing

No new tests needed. Previous test erroneously covered this and that test has been fixed in the PR via the above change. Only 175 because a few live ones were skipped and a couple Azure ones don't seem to want to pass for me unless I run them separately (I think it has to do with Storage Emulator)

image

I also tested this in a few simple bots, including one that creates a Teams conversation using this change and it worked fine.

Help

Due to adding additional ChannelData to CreateConversation, I'm not comfortable saying this PR isn't a breaking change. I'd be a little surprised if this were a breaking change, but it just seems like an odd thing to have not been included prior.

  • Somebody who knows better, PLEASE PLEASE PLEASE makes sure adding ChannelData isn't some weird breaking change

- Made MockAdapter.CreateConversation mimic actual code better
@coveralls
Copy link
Collaborator

coveralls commented Sep 6, 2019

Pull Request Test Coverage Report for Build 78268

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 18 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.1%) to 80.488%

Files with Coverage Reduction New Missed Lines %
/libraries/Microsoft.Bot.Builder/BotFrameworkAdapter.cs 18 22.36%
Totals Coverage Status
Change from base Build 77817: 0.1%
Covered Lines: 3432
Relevant Lines: 4264

💛 - Coveralls

@fuselabs
Copy link
Collaborator

fuselabs commented Sep 6, 2019

✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.AI.Luis.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.AI.QnA.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.ApplicationInsights.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.Azure.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.Dialogs.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.TemplateManager.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Configuration.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Connector.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Schema.dll compared against version 4.3.1

@fuselabs
Copy link
Collaborator

fuselabs commented Sep 9, 2019

✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.AI.Luis.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.AI.QnA.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.ApplicationInsights.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.Azure.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.Dialogs.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.TemplateManager.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Configuration.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Connector.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Schema.dll compared against version 4.3.1

@fuselabs
Copy link
Collaborator

fuselabs commented Sep 9, 2019

✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.AI.Luis.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.AI.QnA.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.ApplicationInsights.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.Azure.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.Dialogs.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.TemplateManager.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Configuration.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Connector.dll compared against version 4.3.1
✔️ No Binary Compatibility issues for Microsoft.Bot.Schema.dll compared against version 4.3.1

Copy link
Contributor

@cleemullins cleemullins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the JS Change? We need it in both spots:
https://github.com/microsoft/botbuilder-js/blob/b0793cea52b8307dd5737a98c924995bc1766ec4/libraries/botbuilder/src/botFrameworkAdapter.ts#L277

Once that's ready, we can merge both.

@cleemullins cleemullins added blocked Current progress is blocked on something else. parity with JS labels Sep 10, 2019
@cleemullins
Copy link
Contributor

... and please check Python. To my reading this change is needed there as well:
https://github.com/microsoft/botbuilder-python/blob/9d41ec40f51fcf70298f70adab99721ea7676be8/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L183

@mdrichardson
Copy link
Contributor Author

mdrichardson commented Sep 10, 2019

@cleemullins On it. Should be able to knock out both tomorrow.

Edit: I've got a support ticket that might delay this. Will have it done by the end of the week, regardless.

Edit 2: Support ticket has evolved into another. Will push to next week.

@mdrichardson
Copy link
Contributor Author

@cleemullins This one good to merge?

@cleemullins cleemullins merged commit d82bc2a into master Sep 17, 2019
@cleemullins cleemullins deleted the createConversation branch September 17, 2019 23:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

blocked Current progress is blocked on something else.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CreateConversationAsync doesn't pass the tenantId

6 participants