Skip to content

Conversation

@rido-min
Copy link
Member

This pull request introduces the foundational structure for the new Microsoft.Bot.Core library, establishing core activity and schema types, build configuration, and initial unit tests. The changes set up the basic serialization/deserialization logic for bot activities, extensibility for custom properties, and the CI workflow for automated builds and tests.

Core Library and Schema Implementation:

  • Added the initial implementation of the CoreActivity class and supporting schema types (ActivityTypes, ChannelData, Conversation, ConversationAccount, and extensibility for additional properties) in the Microsoft.Bot.Core.Schema namespace, including JSON serialization/deserialization logic and reply creation methods. [1] [2] [3] [4] [5]
  • Introduced a placeholder for AddBotApplication in Hosting for future extensibility.

Build and Solution Configuration:

  • Added core.slnx solution file referencing the main project, unit test project, and solution items for centralized configuration.
  • Established common build properties and targets in Directory.Build.props and Directory.Build.targets, including code analysis, documentation, and versioning with Nerdbank.GitVersioning. [1] [2]
  • Configured the main project (Microsoft.Bot.Core.csproj) to target both .NET 8 and .NET 10, with appropriate package references for authentication and identity.

Continuous Integration:

  • Introduced a GitHub Actions workflow (core-ci.yaml) for building and testing the core library on push and pull requests to the next/core branch.

Unit Testing:

  • Added a unit test project (Microsoft.Bot.Core.UnitTests) with dependencies on xUnit and coverlet for code coverage, and a test suite validating extensibility and serialization/deserialization of custom activity types. [1] [2]Add .NET solution for extensible bot activity schemas with modern serialization, extension data, and reply support. Includes CI workflow, semantic versioning, and comprehensive unit tests for schema evolution and custom fields.

Add .NET solution for extensible bot activity schemas with modern serialization, extension data, and reply support. Includes CI workflow, semantic versioning, and comprehensive unit tests for schema evolution and custom fields.
Added a permissions section to the Core-CI workflow, granting read access to repository contents and write access to pull-requests. This explicitly defines the workflow's required permissions.
/// </summary>
public static readonly JsonSerializerOptions DefaultJsonOptions = new()
{
WriteIndented = true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Putting this at the bottom most layer means that more space will be used up in the payload

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, but not too much. I think it's ok for now

/// The reply activity automatically swaps the From and Recipient accounts and preserves
/// the conversation context, channel ID, and service URL from the original activity.
/// </remarks>
public CoreActivity CreateReplyActivity(string text = "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding a note: Should this exist here or be in the client layer?

Copy link
Member Author

Choose a reason for hiding this comment

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

added a new optional param to set the type

rido-min and others added 2 commits December 10, 2025 15:00
This pull request introduces several new sample bots and supporting
infrastructure to the `core` directory, demonstrating different usage
scenarios for the Microsoft.Bot.Core SDK. It also adds compatibility
support for legacy Bot Framework bots, improves development environment
configuration, and updates documentation and gitignore settings.

**New sample bots and scenarios:**

- Added three new sample projects:
-
[`CompatBot`](diffhunk://#diff-22411d9bef78e3d139f1e4b1a4d5e047bb26428a97bf59df7f5b983e584babd8R1-R13):
Demonstrates running a legacy Bot Framework bot using the new
compatibility layer, including `EchoBot` implementation and required
configuration files.
[[1]](diffhunk://#diff-22411d9bef78e3d139f1e4b1a4d5e047bb26428a97bf59df7f5b983e584babd8R1-R13)
[[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aR1-R35)
[[3]](diffhunk://#diff-62be1f70aaabb519334fe39cd50c0e25a98717ebb9fab85b688832917c9c75bbR1-R29)
[[4]](diffhunk://#diff-834a6cbae004839d32944b2f2a3cf8edc3a32f558597d464401178fa95781edcR1-R9)
-
[`CoreBot`](diffhunk://#diff-1087baf076a83b00d0c97ef01c02174668cb26c9fad5d2c33284e0889150ed65R1-R13):
Shows a simple bot using the new SDK, with configuration and logging
settings.
[[1]](diffhunk://#diff-1087baf076a83b00d0c97ef01c02174668cb26c9fad5d2c33284e0889150ed65R1-R13)
[[2]](diffhunk://#diff-b94b53965e9052345453f2ab6bec21420a36c4b67c9a6c568b9c80edcd0882d1R1-R22)
[[3]](diffhunk://#diff-84b21a8c78e12fee4df3b2d67483407632a1fe5d25691ed7cfefde85adc92a25R1-R11)
-
[`Proactive`](diffhunk://#diff-ffe34fac742569e7a6cfb5589871a8b9571c7692f6af33e167f39cc2b8be3ed3R1-R17):
Demonstrates sending proactive messages using a background worker.
[[1]](diffhunk://#diff-ffe34fac742569e7a6cfb5589871a8b9571c7692f6af33e167f39cc2b8be3ed3R1-R17)
[[2]](diffhunk://#diff-f32e1fd30a40c5aa42855895485dbb9c8b79d4029cd3db1a1446f48846f8604dR1-R10)
[[3]](diffhunk://#diff-61d7e83f772e536a1729f5c12b1b028a2a396a28e2175541489e85d89d2758ecR1-R31)
[[4]](diffhunk://#diff-1342c159b3ce809afd5880d58bd2f17e3eeade347f10d5b8d6d550cb3a0ab8f9R1-R8)
- Added scenario scripts for middleware and proactive messaging,
runnable via dotnet script.
[[1]](diffhunk://#diff-aee4a2e56fbce4adfe46afec84a447a9aab7752f7c24982b51b8475af942124fR1-R34)
[[2]](diffhunk://#diff-8287e53b5a4e259703b929262b11fdb5f783564de364cc184d27a5b7486de729R1-R43)
- Provided an example `launchSettings.json` for local development of
scenarios.

**Compatibility support:**

- Introduced `CompatAdapter` and related classes to bridge new bot
application models with legacy Bot Framework interfaces, enabling easier
migration and integration of existing bots.
[[1]](diffhunk://#diff-ee802b583e856949e14f231284969979f8827efaa484f0b431badb7936809855R1-R116)
[[2]](diffhunk://#diff-e70e201729b0f386ddb70a5d3f83751f2bd0a08e527b0a5265fbb8094a9abe19R1-R27)

**Development environment and documentation improvements:**

- Updated `.devcontainer/devcontainer.json` to add Docker-in-Docker,
.NET 10, and ensure latest feature versions for improved local
development experience.
- Added a `README.md` with instructions for testing and running
scenarios.
- Added common development files to `.gitignore` and included it in the
solution.
[[1]](diffhunk://#diff-af85f59c6492668dca14d5f06b54cc2c3173708c83073e1d947b4c007dc851d6R1-R2)
[[2]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cR4-R12)

**Solution structure updates:**

- Updated `core.slnx` to include new sample projects and `.gitignore` as
solution items.

---

**New sample bots and scenarios:**
- Added `CompatBot`, `CoreBot`, and `Proactive` sample projects with
implementations and configuration files to demonstrate different SDK
usage scenarios.
[[1]](diffhunk://#diff-22411d9bef78e3d139f1e4b1a4d5e047bb26428a97bf59df7f5b983e584babd8R1-R13)
[[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aR1-R35)
[[3]](diffhunk://#diff-62be1f70aaabb519334fe39cd50c0e25a98717ebb9fab85b688832917c9c75bbR1-R29)
[[4]](diffhunk://#diff-834a6cbae004839d32944b2f2a3cf8edc3a32f558597d464401178fa95781edcR1-R9)
[[5]](diffhunk://#diff-1087baf076a83b00d0c97ef01c02174668cb26c9fad5d2c33284e0889150ed65R1-R13)
[[6]](diffhunk://#diff-b94b53965e9052345453f2ab6bec21420a36c4b67c9a6c568b9c80edcd0882d1R1-R22)
[[7]](diffhunk://#diff-84b21a8c78e12fee4df3b2d67483407632a1fe5d25691ed7cfefde85adc92a25R1-R11)
[[8]](diffhunk://#diff-ffe34fac742569e7a6cfb5589871a8b9571c7692f6af33e167f39cc2b8be3ed3R1-R17)
[[9]](diffhunk://#diff-f32e1fd30a40c5aa42855895485dbb9c8b79d4029cd3db1a1446f48846f8604dR1-R10)
[[10]](diffhunk://#diff-61d7e83f772e536a1729f5c12b1b028a2a396a28e2175541489e85d89d2758ecR1-R31)
[[11]](diffhunk://#diff-1342c159b3ce809afd5880d58bd2f17e3eeade347f10d5b8d6d550cb3a0ab8f9R1-R8)
- Added scenario scripts for middleware and proactive messaging, plus an
example launch settings file for local testing.
[[1]](diffhunk://#diff-aee4a2e56fbce4adfe46afec84a447a9aab7752f7c24982b51b8475af942124fR1-R34)
[[2]](diffhunk://#diff-8287e53b5a4e259703b929262b11fdb5f783564de364cc184d27a5b7486de729R1-R43)
[[3]](diffhunk://#diff-19cd1809f42bd0d871748a1e3bf7c705961f9abd0a4da67acc547f42c1ebfcd6R1-R20)

**Compatibility support:**
- Introduced `CompatAdapter` and `CompatActivity` to support running
legacy Bot Framework bots with the new SDK.
[[1]](diffhunk://#diff-ee802b583e856949e14f231284969979f8827efaa484f0b431badb7936809855R1-R116)
[[2]](diffhunk://#diff-e70e201729b0f386ddb70a5d3f83751f2bd0a08e527b0a5265fbb8094a9abe19R1-R27)

**Development environment and documentation:**
- Enhanced `.devcontainer` with Docker-in-Docker, .NET 10, and latest
feature versions for improved local development.
- Added a `README.md` with setup and testing instructions.
- Updated `.gitignore` and included it in the solution for better source
control hygiene.
[[1]](diffhunk://#diff-af85f59c6492668dca14d5f06b54cc2c3173708c83073e1d947b4c007dc851d6R1-R2)
[[2]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cR4-R12)

**Solution structure:**
- Updated `core.slnx` to include new projects and configuration files.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: rido-min <[email protected]>
@rido-min rido-min added the CORE label Dec 11, 2025
rido-min and others added 22 commits December 10, 2025 17:46
Updated Azure DevOps pipeline to trigger only on next/* branches and use ubuntu-22.04. Added cd-core.yaml to solution items in core.slnx. Removed null-forgiving operator from CoreActivity.cs return statement for safer null handling.
Added a UseDotNet@2 task to install .NET 8 SDK (8.0.x) before the .NET 10 SDK in the BuildTestPack job. This ensures both SDK versions are available for build and test processes.
Changed package icon to bot_icon.png in project properties. Added ItemGroup to explicitly include bot_icon.png and README.md at the root of the NuGet package during packing.
Added a new bot_icon.png file to the project, providing a graphical asset that can be used as an icon or visual element within the application.
Changed the pipeline condition so that NuGet packages are pushed only when building from the refs/heads/next/core branch, instead of the main branch. This restricts package publishing to the next/core branch.
Ignored launchSettings.json, appsettings.Development.json, and .runsettings to prevent tracking of local configuration and test settings files.
Introduce Microsoft.Bot.Core.Tests targeting .NET 10.0 with xUnit and code coverage. Add core-test.yaml workflow to run these tests with Azure AD credentials. Update solution file to include new test project and workflow. Implement ConversationClientTest for Teams activity scenarios. Update core-ci.yaml to run only unit tests.
Updated the build pipeline to run tests only for the Microsoft.Bot.Core.UnitTests project. Changed environment variable to "TEST_CONVERSATIONID" in ConversationClientTest.cs and corrected the hardcoded conversation ID format by removing the message ID suffix.
- Prefix echo replies with "Echo from BF Compat"
- Change default log level to Warning; add Debug for Microsoft.Bot
- Remove using statement for TurnContext in CompatAdapter
- Expand exception handling to rethrow non-HttpOperationException
- Add debug/info logging to BotApplication activity processing
Introduce .editorconfig for code style and nullable strictness. Update solution to include .editorconfig. Rename CoreActivity.CreateReplyActivity to CreateReplyMessageActivity and update all usages. Extend CoreActivityJsonContext for Int64/Double support. Apply minor formatting fixes and missing braces. Strengthen and update unit tests for new property types and method changes.
Replaced all var declarations with explicit types across the codebase, including tests, bot implementations, and entry points. This improves code clarity and type safety, making variable types more visible and aiding maintainability. No functional changes were made.
Added copyright and MIT license headers to all source and test files.
Updated .editorconfig to enforce file header template for new files.
Made minor code style improvements and access modifier updates. Ensured
consistent attribution and licensing across the codebase.
EchoBot now informs users how to trigger a proactive message via a new `/api/notify/{conversationId}` endpoint. Added a GET endpoint to send proactive messages to a conversation by ID. Updated message handling to support CancellationToken and included necessary usings for proactive messaging support.
Integrate Azure Monitor Application Insights telemetry into both
CompatBot and CoreBot using OpenTelemetry. Update appsettings.json to
include a placeholder Application Insights connection string and adjust
logging levels for better diagnostics. Refactor EchoBot to accept an
ILogger and log version info; comment out some unused message handlers.
Improve CoreBot reply robustness by safely extracting conversation type.
Reformat project files for consistency and explicitly add Azure Monitor
package. Update Proactive Worker to use constants for ServiceUrl and
FromId. Refactor ConversationClient to use StringContent for activity
payloads, ensuring correct JSON serialization and content type.
Removed unnecessary using directives from EchoBot.cs and ConversationClient.cs. Updated TryGetValue in Program.cs to use object? for better type safety and clarity.
Refactored pipeline triggers to use path filters for PRs, targeting only core/** changes. Removed obsolete trigger config and comments. Introduced PushToADOFeed variable to control NuGet push step, replacing branch-based condition.
rido-min and others added 15 commits December 12, 2025 15:08
This pull request introduces significant improvements to the
authentication and configuration system for bot applications, focusing
on simplifying and unifying the way MSAL (Microsoft Authentication
Library) configuration is handled. It introduces a new configuration
API, refactors service registration methods, and adds a new test project
to validate these changes. Additionally, it updates code style and
suppresses certain warnings for better developer experience.

**Authentication & Configuration Refactoring:**

* Refactored the authentication service registration by replacing
`AddBotApplicationClients` with a new `AddConversationClient` method,
which provides a more flexible and unified way to configure MSAL using
different sources (config section, environment variables, or Bot
Framework config). This includes new helper methods for configuring MSAL
with secrets, managed identity, or config sections.
(`core/src/Microsoft.Bot.Core/Hosting/AddBotApplicationExtensions.cs`,
`core/src/Microsoft.Bot.Core/Hosting/BotAuthenticationHandler.cs`,
`core/src/Microsoft.Bot.Core/Hosting/BotConfig.cs`)
[[1]](diffhunk://#diff-728b405fea621393bf54709dd9edcf171d5c2a2113e8a3fbf4732f403ba4e235R63-R199)
[[2]](diffhunk://#diff-728b405fea621393bf54709dd9edcf171d5c2a2113e8a3fbf4732f403ba4e235L45-R49)
[[3]](diffhunk://#diff-728ccc3d98609bc95b459589eb6973c2d6fa67d456334edf7b2a9c3cc1bb52c1R1-R38)
[[4]](diffhunk://#diff-3e082ff899db0608432b5278502dfa1b5765cf4cf34c5a7c63fdf507d1746e3aL52-R61)
[[5]](diffhunk://#diff-3e082ff899db0608432b5278502dfa1b5765cf4cf34c5a7c63fdf507d1746e3aL110-R109)

* Updated the sample project (`Proactive`) and the main extension method
to use `AddConversationClient` instead of the old
`AddBotApplicationClients`, ensuring all samples and new code use the
unified registration approach. (`core/samples/Proactive/Program.cs`,
`core/samples/CoreBot/CoreBot.csproj`)
[[1]](diffhunk://#diff-f32e1fd30a40c5aa42855895485dbb9c8b79d4029cd3db1a1446f48846f8604dL9-R9)
[[2]](diffhunk://#diff-1087baf076a83b00d0c97ef01c02174668cb26c9fad5d2c33284e0889150ed65R7)

**Testing & Validation:**

* Added a new test project `msal-config-api` with a sample program to
validate the new MSAL configuration API and ensure that the new
registration and authentication flow works as expected.
(`core/test/msal-config-api/Program.cs`,
`core/test/msal-config-api/msal-config-api.csproj`, `core/core.slnx`)
[[1]](diffhunk://#diff-11109e323e3906c20862f811ae5cd1fed439a5993872152d08b0fc80ea7be8f1R1-R47)
[[2]](diffhunk://#diff-8764e4985371ddc60cf5f1c97c350ee3440584be4013586deb0b21116898f2d3R1-R15)
[[3]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cR18)

**Developer Experience Improvements:**

* Updated `.editorconfig` to suppress certain warnings (e.g., missing
XML comments, logger performance) for both the main codebase and
samples, making development smoother. (`core/.editorconfig`)
[[1]](diffhunk://#diff-f8a1aa667bae260675fe0c49b3ad037b4ce945cbb1ad3fb36a57a608695c3f11R14-R15)
[[2]](diffhunk://#diff-f8a1aa667bae260675fe0c49b3ad037b4ce945cbb1ad3fb36a57a608695c3f11R36-R38)

**Other Minor Changes:**

* Added a missing `using` directive and made minor code cleanup in
hosting and authentication handler files.
(`core/src/Microsoft.Bot.Core/Hosting/AddBotApplicationExtensions.cs`,
`core/src/Microsoft.Bot.Core/Hosting/BotAuthenticationHandler.cs`)
[[1]](diffhunk://#diff-728b405fea621393bf54709dd9edcf171d5c2a2113e8a3fbf4732f403ba4e235R4)
[[2]](diffhunk://#diff-3e082ff899db0608432b5278502dfa1b5765cf4cf34c5a7c63fdf507d1746e3aL13)

These changes collectively modernize and streamline bot authentication,
making it more robust and easier to configure for different deployment
scenarios.
- Use HTML line breaks in bot replies and proactive messages for better formatting.
- Send proactive messages with MessageFactory.Text.
- Extract AgenticIdentity per activity instead of storing on ConversationClient.
- Register ConversationClient HttpClient with authentication handler.
- Throw exception if no valid MSAL config is found.
- Remove unused using directive in BotApplication.cs.
Added UMI support to Core. This is done via `ManagedIdentityOptions`
that need to be set. This type of auth is a bit off-band with the rest
of MSAL.

* Added UMI support (tested it)
* Add some debug logging to tell us what kind of logs are being used.
Unsure if this is the right approach TBH.
* Add some unit tests
This pull request introduces a new sample bot called `AFBot`, along with
several improvements to resource handling, logging, and activity
response types in the core libraries. The most significant changes are
the addition of the `AFBot` sample (demonstrating integration with Azure
OpenAI and Application Insights), updates to the way activities are sent
and responded to (now returning typed `ResourceResponse` objects), and
enhancements to logging and configuration for more robust diagnostics.

**Key changes:**

### New Sample Bot: AFBot
- Added the `AFBot` sample project, including its project file
(`AFBot.csproj`), middleware (`DropTypingMiddleware.cs`), main program
(`Program.cs`), and configuration/resource files for Application
Insights integration. This sample demonstrates using Azure OpenAI and
telemetry in a bot application.
[[1]](diffhunk://#diff-e2502fc8bf931520eb7b37845a0ef4336820b422d8974475727f96e389454feaR1-R21)
[[2]](diffhunk://#diff-b921767a8b614972c7a3bb5308b4fd797c60d44de331b9656065f3adbee7a248R1-R16)
[[3]](diffhunk://#diff-b2eaa16ee58a54a25acb5e930ace0fe03ca3dea7b34c67a265dcddc8500ae41bR1-R41)
[[4]](diffhunk://#diff-2c32c8a51d8362325fac473adb2c99e2233dd9373529a9f8e07a6f3a3291adf2R1-R67)
[[5]](diffhunk://#diff-1694d6bdb818a04ebfc71382c65a682d7dc506a02632c8cde236f23d9a6cf571R1-R8)
[[6]](diffhunk://#diff-ee44fc86192f51de6e025280640b7153430c1214bd4fa8db9eb06f0beeb6f54aR1-R10)
[[7]](diffhunk://#diff-5cfff353a21840d25b0e5f1e0821ae7683f18e8d8659c2ea1b723f51eadb7a1cR1-R10)
[[8]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cR13)

### Activity Sending and Response Handling
- Changed `BotApplication.SendActivityAsync` and
`ConversationClient.SendActivityAsync` to return a strongly typed
`ResourceResponse` object (instead of just a string ID), improving type
safety and extensibility. Also added a `SendTypingActivityAsync` helper.
[[1]](diffhunk://#diff-eaf09c60c6baf0a5c99db7670427f663dfa0d7097f2eeb97691b35eb2a509ab4L120-R141)
[[2]](diffhunk://#diff-0e831e4dc2aa2a5ce9c9830150117b244a841d76e56975055bc2fd9550fd1341L28-R29)
[[3]](diffhunk://#diff-0e831e4dc2aa2a5ce9c9830150117b244a841d76e56975055bc2fd9550fd1341L41-R71)
- Updated `CompatBotAdapter` to use the new `ResourceResponse` type and
improved handling/logging for null responses.
[[1]](diffhunk://#diff-a78277c4f790d08eca9fabaddd59cc03cd6de93ee7ff87eabb0bfc254dce0030L19-R22)
[[2]](diffhunk://#diff-a78277c4f790d08eca9fabaddd59cc03cd6de93ee7ff87eabb0bfc254dce0030L41-R61)
[[3]](diffhunk://#diff-a78277c4f790d08eca9fabaddd59cc03cd6de93ee7ff87eabb0bfc254dce0030L64-R74)

### Logging and Configuration Improvements
- Enhanced logging in the conversation client configuration, including
debug and warning logs for MSAL (Microsoft Authentication Library)
configuration detection. Improved handling of missing configuration by
conditionally adding the authentication handler.
[[1]](diffhunk://#diff-728b405fea621393bf54709dd9edcf171d5c2a2113e8a3fbf4732f403ba4e235R77-R88)
[[2]](diffhunk://#diff-728b405fea621393bf54709dd9edcf171d5c2a2113e8a3fbf4732f403ba4e235L100-R119)
- Added missing `using` directives for logging in relevant files.
[[1]](diffhunk://#diff-a78277c4f790d08eca9fabaddd59cc03cd6de93ee7ff87eabb0bfc254dce0030R7)
[[2]](diffhunk://#diff-0e831e4dc2aa2a5ce9c9830150117b244a841d76e56975055bc2fd9550fd1341R4)

### Miscellaneous Improvements and Fixes
- Fixed a bug in the proactive sample where the correct activity ID is
now logged after sending a message.
- Minor improvement: Added a root endpoint to the `CoreBot` sample for
easier health checks.
- Cleaned up unused variables in the Azure DevOps pipeline YAML.
AgenticIdentity class moved from BotAuthenticationHandler.cs to AgenticIdentity.cs in the Microsoft.Bot.Core.Schema namespace. The class is now public and has improved XML documentation. No changes to logic or properties.
- added logic for JWT validation for bots & agents
- tested locally with core bot (successful case & error case with
invalid scope URL)
- integration tests to be added once we decide on infrastructure for
core

---------

Co-authored-by: lilydu <[email protected]>
Co-authored-by: Ricardo Minguez Pablos (RIDO) <[email protected]>
Co-authored-by: Rido <[email protected]>
Set IsPackable to false in msal-config-api.csproj

Added the IsPackable property and set it to false in the project file to prevent msal-config-api from being packed into a NuGet package. This ensures the project is not inadvertently distributed as a package.
…ient (#259)

This pull request introduces several improvements and new features to
the sample bots, test organization, and build process. The most
significant changes are the addition of a comprehensive "AllFeatures"
Teams bot sample, enhancements to the proactive messaging and activity
handling in the sample bots, and better organization of solution and
test projects. Below are the most important changes grouped by theme.

**New Features & Samples**

* Added a new `AllFeatures` Teams bot sample, including its project
(`AllFeatures.csproj`), configuration (`appsettings.json`), HTTP test
file, and main program logic demonstrating message handling, typing
activities, and mentions.
[[1]](diffhunk://#diff-c6d02c3a9a28c1afb6380d7f24485630894a3488bd6529f31cca342583be4897R1-R13)
[[2]](diffhunk://#diff-ea0a609f6688222857d8302f64ba6a7d75aa4ffb1f9a70588b86caacd73dbad1R1-R9)
[[3]](diffhunk://#diff-7c963be5ba9074d831ef650e68af0360787eb197181c39a12d0661a92c62fbc1R1-R6)
[[4]](diffhunk://#diff-166193a2c938377ccf1794248deeb2df8cfafeb883aa6581b316b3fa9e361cdcR1-R28)

**Sample Bot Improvements**

* Enhanced `AFBot` and `CoreBot` activity handling to use builder
patterns for creating reply activities and improved handling of activity
properties, cancellation tokens, and logging.
[[1]](diffhunk://#diff-b2eaa16ee58a54a25acb5e930ace0fe03ca3dea7b34c67a265dcddc8500ae41bR33-R61)
[[2]](diffhunk://#diff-b94b53965e9052345453f2ab6bec21420a36c4b67c9a6c568b9c80edcd0882d1L20-R20)
[[3]](diffhunk://#diff-b94b53965e9052345453f2ab6bec21420a36c4b67c9a6c568b9c80edcd0882d1L29-R37)
* Improved proactive messaging in the `Proactive` sample by moving the
message text to the `Properties["text"]` field and updating the build
configuration to prevent packaging.
[[1]](diffhunk://#diff-61d7e83f772e536a1729f5c12b1b028a2a396a28e2175541489e85d89d2758ecL23-R28)
[[2]](diffhunk://#diff-ffe34fac742569e7a6cfb5589871a8b9571c7692f6af33e167f39cc2b8be3ed3L7-R7)
* Expanded `CompatBot` functionality with a new middleware
(`MyCompatMiddleware`), proactive messaging using the Conversations API,
adaptive card feedback handling, and more complete Teams event handling
(members added/removed, meeting start, invoke activities).
[[1]](diffhunk://#diff-cef44960d160cf6ea51b595745c079353501a962650d7c9684bd9fa6e1456220R1-R65)
[[2]](diffhunk://#diff-7ebf5cb9bab327c9f3ac4408277a56833a7622a64e74bb08742ec37804ed3878R1-R17)
[[3]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL25-R71)
[[4]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL55-R135)
[[5]](diffhunk://#diff-62be1f70aaabb519334fe39cd50c0e25a98717ebb9fab85b688832917c9c75bbR33-R34)

**Solution & Test Organization**

* Refactored the solution file (`core.slnx`) to organize sample and test
projects into folders, added new Teams bot app test project, and
included the new Teams bot app source project.
[[1]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cR2-R17)
[[2]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cL13-R37)

**Build & CI Process**

* Updated the CI workflow to build the core tests directory explicitly,
improving test reliability and clarity in the build steps.

**Minor Fixes**

* Fixed encoding in the copyright header for `DropTypingMiddleware.cs`.

---------

Co-authored-by: heyitsaamir <[email protected]>
BF Adapter base expects an Id in the SendActivity return value.

Without this fix, the compat layer throws NRE

This pull request introduces several updates to the bot framework sample
applications and core libraries, mainly focusing on improving the
handling and propagation of `InvokeResponse` objects, refining status
codes, and enhancing logging and code structure. The changes help
standardize response formats, improve traceability, and clarify code
intent.

**InvokeResponse Handling and Status Codes**

* Added an `Id` property to the `InvokeResponse` class, ensuring
responses can be correlated to originating activities, and updated
serialization attributes for `Body` and `Type` to ignore nulls for
cleaner JSON output.
[[1]](diffhunk://#diff-0bb90273f82a3dca26df988769c1097864caf7838c52c6f100bcb52dfffda755R16-R22)
[[2]](diffhunk://#diff-0bb90273f82a3dca26df988769c1097864caf7838c52c6f100bcb52dfffda755R34)
[[3]](diffhunk://#diff-0bb90273f82a3dca26df988769c1097864caf7838c52c6f100bcb52dfffda755L35-R44)
* Standardized and diversified status codes for `InvokeResponse` across
sample bots and core libraries (`EchoBot`, `CoreBot`, `TeamsBot`, and
core adapter), improving clarity in response semantics.
[[1]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL116-R94)
[[2]](diffhunk://#diff-b94b53965e9052345453f2ab6bec21420a36c4b67c9a6c568b9c80edcd0882d1L36-R37)
[[3]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL65-R65)
[[4]](diffhunk://#diff-ee802b583e856949e14f231284969979f8827efaa484f0b431badb7936809855L81-R91)
[[5]](diffhunk://#diff-a67e36b1d9c8013e013bbdef9a54f3051a67f3905405e6ce85ca46f8b50a73a8L53-R53)

**Refactoring and Code Structure**

* Moved proactive message send/update/delete logic in `EchoBot` to a
dedicated helper method (`SendUpdateDeleteActivityAsync`), improving
code readability and maintainability.
[[1]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL42-R40)
[[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aR115-R141)
* Minor code cleanup in `EchoBot.cs`, such as removing unused `using`
statements.

**Logging and Diagnostics**

* Enhanced logging in `CompatBotAdapter` to provide better traceability
of activity responses, replacing a warning for null responses with
information logs and always assigning the response ID.

**Other Improvements**

* Added null-handling and improved response assignment in activity
deletion logic for the compat adapter.

These updates collectively improve the reliability, maintainability, and
clarity of bot applications and supporting libraries.
- added usertokenclient class and extension to hosting 
- added to botappplication
- introduced usertokenclient.models
- added compat usertokenclient
- added to teamsbotapplication
- tested locally with ABSTokenServiceClient
- tested with sso sample 

note: `await WriteInvokeResponseToHttpResponseAsync(activity.Value as
InvokeResponse,cancellationToken).ConfigureAwait(false);` seems to
create issues for invoke responses

---------

Co-authored-by: Mehak Bindra <[email protected]>
Co-authored-by: Ricardo Minguez Pablos (RIDO) <[email protected]>
Add Teams activity support and extensibility with tests

- Introduce TeamsActivity and TeamsConversationAccount support,
including conversion and deserialization methods.
- Enhance ToCompatChannelAccount to extract Teams-specific properties.
- Make ConversationClient.GetConversationMemberAsync generic.
- Remove generic CoreActivity.FromJsonString<T>; use
TeamsActivity.FromJsonString.
- Add extensibility patterns for custom activity/channel data types.
- Add unit and integration tests for TeamsInfo and activity conversion.
- Update solution and test projects to include compat and Teams
libraries.
- Add InternalsVisibleTo for test access and improve code comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants