Skip to content

Remove concrete Conversations cast to enable DI of IConversations implementations#15

Merged
rido-min merged 4 commits intomainfrom
copilot/fix-issue-6905-again
Dec 17, 2025
Merged

Remove concrete Conversations cast to enable DI of IConversations implementations#15
rido-min merged 4 commits intomainfrom
copilot/fix-issue-6905-again

Conversation

Copy link

Copilot AI commented Dec 17, 2025

Two locations in the codebase cast IConversations to the concrete Conversations class to call GetConversationMemberAsync, preventing dependency injection of custom implementations.

Changes

Added missing interface method

  • Added GetConversationMemberWithHttpMessagesAsync(string userId, string conversationId, ...) to IConversations interface
  • Added corresponding GetConversationMemberAsync extension method for IConversations

Removed concrete casts

  • TeamsInfo.GetMemberAsync: ((Conversations)connectorClient.Conversations).GetConversationMemberAsync(...)connectorClient.Conversations.GetConversationMemberAsync(...)
  • SkillHandlerImpl.OnGetMemberAsync: ((Conversations)client.Conversations).GetConversationMemberAsync(...)client.Conversations.GetConversationMemberAsync(...)

Updated test mocks

  • Implemented new interface method in MemoryConversations

Before/After

// Before - forced to use concrete implementation
var member = await ((Conversations)connectorClient.Conversations)
    .GetConversationMemberAsync(userId, conversationId, cancellationToken);

// After - works with any IConversations implementation
var member = await connectorClient.Conversations
    .GetConversationMemberAsync(userId, conversationId, cancellationToken);

This enables custom adapter implementations and test mocks to provide their own IConversations implementations without being forced to inherit from the concrete Conversations class.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • slack.botframework.com
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/botbuilder-dotnet/botbuilder-dotnet/tests/Microsoft.Bot.Connector.Tests/bin/Debug/net9.0/Microsoft.Bot.Connector.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/botbuilder-dotnet/botbuilder-dotnet/tests/Microsoft.Bot.Connector.Tests/bin/Debug/net9.0/Microsoft.Bot.Connector.Tests.deps.json /home/REDACTED/work/botbuilder-dotnet/botbuilder-dotnet/tests/Microsoft.Bot.Connector.Tests/bin/Debug/net9.0/testhost.dll --port 46723 --endpoint 127.0.0.1:046723 --role client --parentprocessid 4929 --datacollectionport 0 --telemetryoptedin false tFrameworkAuthentication.cs (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/botbuilder-dotnet/botbuilder-dotnet/tests/Microsoft.Bot.Connector.Tests/bin/Debug/net8.0/Microsoft.Bot.Connector.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/botbuilder-dotnet/botbuilder-dotnet/tests/Microsoft.Bot.Connector.Tests/bin/Debug/net8.0/Microsoft.Bot.Connector.Tests.deps.json /home/REDACTED/work/botbuilder-dotnet/botbuilder-dotnet/tests/Microsoft.Bot.Connector.Tests/bin/Debug/net8.0/testhost.dll --port 34097 --endpoint 127.0.0.1:034097 --role client --parentprocessid 4936 --datacollectionport 0 --telemetryoptedin false tFrameworkAuthentication.cs (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/botbuilder-dotnet/botbuilder-dotnet/tests/Microsoft.Bot.Connector.Tests/bin/Debug/net9.0/Microsoft.Bot.Connector.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/botbuilder-dotnet/botbuilder-dotnet/tests/Microsoft.Bot.Connector.Tests/bin/Debug/net9.0/Microsoft.Bot.Connector.Tests.deps.json /home/REDACTED/work/botbuilder-dotnet/botbuilder-dotnet/tests/Microsoft.Bot.Connector.Tests/bin/Debug/net9.0/testhost.dll --port 42185 --endpoint 127.0.0.1:042185 --role client --parentprocessid 5175 --datacollectionport 0 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

fix this issue https://github.com/microsoft/botbuilder-dotnet/issues/6905


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 17, 2025 04:58
…concrete Conversations class

Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com>
Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com>
Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with bot framework integration Remove concrete Conversations cast to enable DI of IConversations implementations Dec 17, 2025
Copilot AI requested a review from rido-min December 17, 2025 05:04
@rido-min rido-min marked this pull request as ready for review December 17, 2025 05:10
@rido-min rido-min merged commit 0c8eafd into main Dec 17, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants