Skip to content

Initial core bot activity library, CI, and extensibility#227

Draft
rido-min wants to merge 102 commits intomainfrom
next/core
Draft

Initial core bot activity library, CI, and extensibility#227
rido-min wants to merge 102 commits intomainfrom
next/core

Conversation

@rido-min
Copy link
Copy Markdown
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.
Comment thread .github/workflows/core-ci.yaml Fixed
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.
Comment thread core/src/Microsoft.Bot.Core/Schema/Conversation.cs Outdated
Comment thread core/src/Microsoft.Teams.Bot.Core/Schema/CoreActivity.cs
Comment thread core/src/Microsoft.Bot.Core/Schema/CoreActivity.cs Outdated
/// </summary>
public static readonly JsonSerializerOptions DefaultJsonOptions = new()
{
WriteIndented = true,
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread core/src/Microsoft.Bot.Core/Schema/CoreActivity.cs Outdated
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] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com>
@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 29 commits March 3, 2026 17:09
…lds) (#360)

This pull request introduces comprehensive changes to support
nullability for key properties in activity-related classes and their
usage throughout the codebase. The main goal is to improve robustness
when handling activities that may lack sender, recipient, or
conversation information, and to ensure consistent null handling in both
implementation and tests.

Key changes include:

- Making `From`, `Recipient`, and `Conversation` properties nullable in
activity and related classes.
- Updating constructors, methods, and serialization logic to handle
possible null values.
- Adjusting tests to account for and verify nullability.

The most important changes are:

**Core Schema and Model Updates:**

* Made the `From`, `Recipient`, and `Conversation` properties nullable
in `CoreActivity`, `TeamsActivity`, and related classes, and updated
constructors to handle null inputs gracefully. This ensures activities
can be created and processed even when some participants or conversation
info are missing.
[[1]](diffhunk://#diff-aa65632fe28a87aec3d29025384c7f1e687d5839d848f1220e8ed59e76dcd35bL55-R63)
[[2]](diffhunk://#diff-b9fe8c2661f373312865c34021dcd68b97c7a7308d3814767e941a9e275212f4L100-R134)
[[3]](diffhunk://#diff-ab03c7985a1673a73536a9756293c78cba898a0de6197501e596ad144582a41aL31-R36)
[[4]](diffhunk://#diff-5b4ce81153a4e786cdcc3ed1fce3951c3285b532d484ec1df6b20d9e40a359e4L48-R54)
* Changed entity and attachment collections (`EntityList`,
`TeamsAttachment`) to return `null` instead of empty collections when
input JSON arrays are null, standardizing the nullability contract.
[[1]](diffhunk://#diff-54676e96eda404a3efa65124857df40e5cb3e19ec4a2b1222c9e08cacac8eaa0L46-R50)
[[2]](diffhunk://#diff-7d6dee59c1c828283d2d29d6f55c39949d8a35887c613f85643286c553e6f1a3L118-R122)

**Method and API Usage Adjustments:**

* Updated various method signatures and internal usages to accept
nullable types and to check for nulls before accessing properties,
including in `WithFrom`, `WithRecipient`, and `WithConversation` builder
methods, and in `AgenticIdentity` extraction logic.
[[1]](diffhunk://#diff-5e00975e375bcb87e6b0d28d2367d865865a1254f089cfcab0d6abbb5db4be38L147-R152)
[[2]](diffhunk://#diff-21605a1ddfd84b8b511a41a957d5e130441cf05eb3dc192579480425e0746a0aL58-R58)
[[3]](diffhunk://#diff-2b447b715e5c577302421ca232985ced9354b64def7b26219525758928d097daL61-R61)
[[4]](diffhunk://#diff-d62a8ce4aac677906758eb430b84c9432f61ff95342701fdcae909310e2aed27L69-R69)
[[5]](diffhunk://#diff-d62a8ce4aac677906758eb430b84c9432f61ff95342701fdcae909310e2aed27L99-R99)
[[6]](diffhunk://#diff-d62a8ce4aac677906758eb430b84c9432f61ff95342701fdcae909310e2aed27L153-R153)
[[7]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL152-R152)

**Test Suite Updates:**

* Updated unit tests to expect nulls for properties and collections
where appropriate, and to use null-safe assertions and property access
throughout.
[[1]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL23-R25)
[[2]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL115-R116)
[[3]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL132-R133)
[[4]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL152-R154)
[[5]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL171-R172)
[[6]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL262-R262)
[[7]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL292-R292)
[[8]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL415-R415)
[[9]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL450-R454)
[[10]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL536-R536)
[[11]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL551-R551)
[[12]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL679-R680)
[[13]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL697-R698)
[[14]](diffhunk://#diff-ec253b7d2876187c3585381aa6cd8b1cbfca2227eb6ac23752253bbcda19484fL714-R714)

**Constructor and Null Handling Improvements:**

* Constructors for `TeamsConversationAccount` and `TeamsConversation`
now handle null arguments without throwing exceptions, returning early
if input is null.
[[1]](diffhunk://#diff-ab03c7985a1673a73536a9756293c78cba898a0de6197501e596ad144582a41aL31-R36)
[[2]](diffhunk://#diff-5b4ce81153a4e786cdcc3ed1fce3951c3285b532d484ec1df6b20d9e40a359e4L48-R54)

**General Codebase Consistency:**

* Ensured all usages of `From`, `Recipient`, `Conversation`, `Entities`,
and `Attachments` are null-safe across the codebase, including in
activity updates, deletions, and proactive messaging scenarios.
[[1]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL152-R152)
[[2]](diffhunk://#diff-b9fe8c2661f373312865c34021dcd68b97c7a7308d3814767e941a9e275212f4R74-R88)

These changes collectively make the bot framework more resilient to
incomplete or partially populated activities and improve code safety and
clarity when handling optional data.
- Removed TeamsBotApplicationBuilder and static CreateBuilder/Run
pattern.
- Introduced DI-based AddTeamsBotApplication<TApp>() and
UseTeamsBotApplication<TApp>() extension methods for flexible bot
registration and endpoint configuration.
- Added CustomHosting sample project demonstrating custom
TeamsBotApplication subclassing and registration.
- Renamed ITurnMiddleWare to ITurnMiddleware; updated middleware usage
to UseMiddleware.
- Made ConversationClient and UserTokenClient methods virtual for
extensibility.
- Improved type safety, replaced var with explicit types, and modernized
code style across samples and tests.
- Updated all samples to use new hosting and middleware APIs.
- Improved documentation, error handling, and code consistency.
- No breaking changes for DI-based consumers; legacy builder pattern
removed.

This pull request introduces a new `CustomHosting` sample to demonstrate
custom hosting scenarios for Teams bots, and applies a variety of
improvements and modernizations across several existing bot samples. Key
changes include the addition of the `CustomHosting` project, improved
type safety, modernization of code patterns, and minor cleanup of unused
usings and dependencies.

**New Sample: Custom Hosting**

* Added a new sample project `CustomHosting`, including
`CustomHosting.csproj`, `MyTeamsBotApp.cs`, `Program.cs`, and
`appsettings.json`, to demonstrate how to set up and run a Teams bot
application with custom hosting logic. (`core/core.slnx`,
`core/samples/CustomHosting/CustomHosting.csproj`,
`core/samples/CustomHosting/MyTeamsBotApp.cs`,
`core/samples/CustomHosting/Program.cs`,
`core/samples/CustomHosting/appsettings.json`)
[[1]](diffhunk://#diff-19ad97af5c1b7109a9c62f830310091f393489def210b9ec1ffce152b8bf958cR18)
[[2]](diffhunk://#diff-9a0a358fefed3a2d514a075dde6393f9d54f88b65e6701443355af6741f8ce80R1-R13)
[[3]](diffhunk://#diff-ec0a36e06aeb2c4f3f7620e01891a6123198cfac9bf6bf1e851ccd913e5b8440R1-R20)
[[4]](diffhunk://#diff-71299e3fd10a90f2601fa1e84cdda5006a3cf3676a2fb32e2ef1e830608558f2R1-R15)
[[5]](diffhunk://#diff-1741a37e03d344704fdb47a90f621df777f6d1888075ec76923bb392ac4e5d0cR1-R9)

**Type Safety and Modernization**

* Improved type safety and code clarity in multiple samples by using
explicit types (e.g., `ChatMessage?`, `SendActivityResponse?`,
`JObject?`, `IList<MeetingParticipantMember>`, etc.), nullable reference
types, and modern C# object initializers.
(`core/samples/AFBot/Program.cs`, `core/samples/CompatBot/EchoBot.cs`,
`core/samples/MeetingsBot/Program.cs`,
`core/samples/AllInvokesBot/Program.cs`,
`core/samples/MessageExtensionBot/Program.cs`)
[[1]](diffhunk://#diff-b2eaa16ee58a54a25acb5e930ace0fe03ca3dea7b34c67a265dcddc8500ae41bL48-R57)
[[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL50-R54)
[[3]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL81-R96)
[[4]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL126-R132)
[[5]](diffhunk://#diff-b0cc7807e2f91f921ec82978833465533c565f637b0aa56802f0d713f6688306L15-R38)
[[6]](diffhunk://#diff-8f290ac497e620d9799b6a57476f6d5051a39df15e2bb71755ffb6849d2b1b35L31-R47)
[[7]](diffhunk://#diff-8f290ac497e620d9799b6a57476f6d5051a39df15e2bb71755ffb6849d2b1b35L51-R58)
[[8]](diffhunk://#diff-8f290ac497e620d9799b6a57476f6d5051a39df15e2bb71755ffb6849d2b1b35L91-R99)
[[9]](diffhunk://#diff-8f290ac497e620d9799b6a57476f6d5051a39df15e2bb71755ffb6849d2b1b35L113-R130)
[[10]](diffhunk://#diff-9da189387a8b06507339b8044bf5a572c0f84620969ebe735248a73252da901fL33-R33)

* Updated middleware usage patterns and naming to align with modern
conventions (e.g., using `UseMiddleware` instead of `Use`, fixing
interface name typo from `ITurnMiddleWare` to `ITurnMiddleware`).
(`core/samples/AFBot/DropTypingMiddleware.cs`,
`core/samples/AFBot/Program.cs`)
[[1]](diffhunk://#diff-b921767a8b614972c7a3bb5308b4fd797c60d44de331b9656065f3adbee7a248L9-R9)
[[2]](diffhunk://#diff-b2eaa16ee58a54a25acb5e930ace0fe03ca3dea7b34c67a265dcddc8500ae41bL31-R32)

**Dependency and Usings Cleanup**

* Removed unused or redundant `using` statements from several files for
clarity and maintainability.
(`core/samples/CompatProactive/ProactiveWorker.cs`,
`core/samples/CompatBot/Cards.cs`, `core/samples/CoreBot/Program.cs`,
`core/samples/AllInvokesBot/Cards.cs`)
[[1]](diffhunk://#diff-cb27bc8500d98e9cd996a878c9d25274502563720748d6ba31525b75e46bbc46L4-L8)
[[2]](diffhunk://#diff-cef44960d160cf6ea51b595745c079353501a962650d7c9684bd9fa6e1456220L4-L6)
[[3]](diffhunk://#diff-b94b53965e9052345453f2ab6bec21420a36c4b67c9a6c568b9c80edcd0882d1L4)
[[4]](diffhunk://#diff-935a6ffb850a503e4af48c17543f2215a7ab022dd4835efb60f8207c01698520L5)

**Project and Build System Updates**

* Added the new `CustomHosting` sample to the solution file `core.slnx`
for inclusion in the build.

**Minor Fixes and Consistency Improvements**

* Standardized variable naming and initialization, improved null
handling, and modernized HTTP client usage in the AllInvokesBot and
other samples. (`core/samples/AllInvokesBot/Program.cs`)
[[1]](diffhunk://#diff-8f290ac497e620d9799b6a57476f6d5051a39df15e2bb71755ffb6849d2b1b35L31-R47)
[[2]](diffhunk://#diff-8f290ac497e620d9799b6a57476f6d5051a39df15e2bb71755ffb6849d2b1b35L51-R58)
[[3]](diffhunk://#diff-8f290ac497e620d9799b6a57476f6d5051a39df15e2bb71755ffb6849d2b1b35L91-R99)
[[4]](diffhunk://#diff-8f290ac497e620d9799b6a57476f6d5051a39df15e2bb71755ffb6849d2b1b35L113-R130)
[[5]](diffhunk://#diff-8f290ac497e620d9799b6a57476f6d5051a39df15e2bb71755ffb6849d2b1b35L283-R288)

These changes collectively improve the maintainability, clarity, and
extensibility of the sample bots, while providing a new example for
custom hosting scenarios.
Port `CitationEntity` and supporting types from main, adapted for
`next/core`.

- Adds `AddCitation`, `AddAIGenerated`, and `AddFeedback` methods to
`TeamsActivity`
- Enables `OMessage` sub-dispatch in `EntityList.FromJsonArray()` with
`@type` routing (`"Message"` --> `CitationEntity`, `"CreativeWork"` -->
`SensitiveUsageEntity`)
- Adds typed `FeedbackLoopEnabled` property to `TeamsChannelData`
- Registers new citation types in `TeamsActivityJsonContext`:
(`CitationEntity`, `CitationClaim`, `CitationAppearanceDocument`,
`CitationImageObject`, `CitationAppearance`)
- Registers previously missing entity types in
`TeamsActivityJsonContext`: (`OMessageEntity`, `SensitiveUsageEntity`,
`DefinedTerm`, `ProductInfoEntity`, `StreamInfoEntity`)
- Unit tests

### Notes
- Not porting `UpdateEntity(IEntity, IEntity`); `AddCitation` does
remove + add inline
- `Samples.AI/CitationsHandler` not ported
- `IMessageEntity` not needed - concrete classes only in 2.1
- `IMessageJsonConverter` replaced by `DeserializeMessageEntity` in
EntityList

---------

Co-authored-by: Corina Gum <>
### New Sample Project: TabApp

- Added `TabApp` sample project to the solution and project files,
including its backend and frontend components.
- Implemented backend logic in `Program.cs` for serving static tab
content, handling Teams authentication, and providing server functions
such as posting messages to chat.

### Frontend Implementation

- Added a React/Vite frontend app with Teams JS SDK and MSAL
integration, supporting features like context display, posting to chat,
user info lookup, and presence toggling.

### Auth
- Added entra token validation and cleaned up jwtExtension
In PA one bot will have two registrations, a normal one and an agentic
one. This means both will have separate client ids and so incomming
token validation should be able to handle both setups.
Documentation improvements:

* For conversation update, event, meeting, and install/update handlers,
all matching handlers are now invoked sequentially rather than only the
first one. This is a breaking change and is documented in the XML
comments for each registration method.

Invoke handler registration restrictions:

* Catch-all invoke handlers (registered via `InvokeExtensions.OnInvoke`)
can no longer be combined with specific invoke handlers (such as
adaptive card or file consent handlers). This restriction is now
enforced and documented as a breaking change.

General cleanup:

* Removed outdated TODO comments and clarified remarks in the
`Context.cs` file.
…ion client (#369)

### Compatibility layer improvements

* Introduced `FromCompatChannelAccount` and
`FromCompatConversationParameters` extension methods in
`CompatActivity.cs` to convert Bot Framework objects to Teams Core
schema, mapping relevant fields and properties.
* Updated `CompatConversations.cs` to use the new
`FromCompatConversationParameters` method for conversation creation,
ensuring full compatibility and proper field mapping.

### Testing

* Added unit tests in `CompatActivityTests.cs` for the new conversion
methods, covering field mapping, null handling, and property population.
Fixed two instances where AddBotAuthentication overloads were called
with parameters in the wrong order:
- Line 39: The sectionName-based overload was passing parameters as
(schemeName, clientId, tenantId, logger) instead of the correct
(clientId, tenantId, schemeName, logger)
- Line 59: The IServiceCollection overload had the same parameter
ordering issue

This ensures that clientId, tenantId, and schemeName are passed to the
correct parameter positions, preventing authentication configuration
errors.

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This PR updates the next/core branch with the latest changes from main.


This pull request introduces significant improvements to the build and
release pipelines for the Teams SDK, including new YAML pipeline files,
refactoring of existing pipelines, and enhancements to the `Activity`
class in the codebase. The changes streamline CI/CD processes, add
support for targeted activities, and improve test result publishing.

Pipeline and CI/CD improvements:

* Added new pipeline files: `.azdo/publish-preview.yaml` for preview
package publishing (manual trigger, supports both internal and public
feeds), `.azdo/publish.yml` for public releases, and
`.azdo/templates/sign-and-pack.yaml` as a shared signing and packing
template. These changes centralize and simplify the release workflow for
internal and public NuGet packages.
[[1]](diffhunk://#diff-385304594914fc0af74bf0fbf7b2bb77eaadd30a583d8b2b4e928db730f5892bR1-R158)
[[2]](diffhunk://#diff-186607033cddd78a2207f2b7acc82e3724148a6703c76d5f45f308a837c7e920R1-R5)
[[3]](diffhunk://#diff-df3149e4326765add7763e50ab1569eaa4b619ebc212e2e9b7498854e8c7dd76R1-R94)
* Refactored `.azdo/ci.yaml` and `.azdo/cd-core.yaml` to improve
triggers, test result publishing, artifact naming, and build
configuration handling. This includes switching artifact names to
`Packages`, publishing test results, and using variables for build
configuration.
[[1]](diffhunk://#diff-d9306c7aa179daae2a93bd588f2df485e65c72de402e1afa7c65efa3f105b825R1-R7)
[[2]](diffhunk://#diff-d9306c7aa179daae2a93bd588f2df485e65c72de402e1afa7c65efa3f105b825L36-R67)
[[3]](diffhunk://#diff-54d52e0bc1c296e6fbaf6daa1236b02f1645a2a1609a7129e4185d0de161e1ebR1-R6)
[[4]](diffhunk://#diff-54d52e0bc1c296e6fbaf6daa1236b02f1645a2a1609a7129e4185d0de161e1ebL68-R74)
* Updated `.github/workflows/codeql.yml` to include the `next/core`
branch in CodeQL analysis for improved security coverage.

Enhancements to the `Activity` class and related activities:

* Added an experimental `IsTargeted` property to `Activity`, with
related methods and merge logic, allowing activities to indicate if they
are targeted. This includes new overloads for `WithRecipient` and proper
merging behavior.
[[1]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aR149-R152)
[[2]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aR230-R242)
[[3]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aR433-R439)
* Refactored `Value` property overrides in several activity classes
(`ActionActivity`, `HandoffActivity`, `AnonQueryLinkActivity`,
`FetchTaskActivity`) to use explicit getter/setter logic, improving type
safety and clarity.
[[1]](diffhunk://#diff-8039eb42926eb743d838475a9692396f17a72ef33f1fdbc1883b59524835ef72L28-R32)
[[2]](diffhunk://#diff-cf9ec41b68de548f026e472cc44faea40af2f9415d91e56baba5eab6849c7243L23-R27)
[[3]](diffhunk://#diff-2e64b26a5c79daa8c735a79d1d0ef7b177757824825771d0e555d0175e0e105fL28-R32)
[[4]](diffhunk://#diff-f0921d5ad7f9df3408669c99b9d12809568feddde82f1521621301ad84cd21f0L28-R32)

These changes collectively modernize and standardize the build, test,
and release process, while also expanding SDK functionality for targeted
activities.

---------

Co-authored-by: Shanmathi Mayuram Krithivasan <37715033+ShanmathiMayuramKrithivasan@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com>
Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Mehak Bindra <mhk0397@gmail.com>
Co-authored-by: Alex Acebo <aacebowork@gmail.com>
Co-authored-by: Kavin <115390646+singhk97@users.noreply.github.com>
## Summary
  - Sanitize MS-CV header value to prevent log forging attacks
  - Remove newline characters before logging
  - Add comprehensive unit tests

  ## Context
Addresses CodeQL security warning: user-provided MS-CV header values
were logged without sanitization, allowing
  malicious users to inject fake log entries via newline characters.

  🤖 Generated with Claude Code

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Rido <rido-min@users.noreply.github.com>
…oing activity. (#374)

1. Refactor PA bot - remove multi-host setup, support two identities
simulatneously (bot & agent)
2. **[PA bug fix]** In `Microsoft.Teams.Bot.Compat`, If `serviceUrl` is
not set in outgoing activity then use the one from the incomming
activity as fallback
3. Make `ConversationAccount.GetAgentIdentity()` public. It's being used
in the compat adapter.

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Rido <rido-min@users.noreply.github.com>
This pull request introduces several enhancements and new features to
the Teams bot sample applications, focusing primarily on expanding the
message handling capabilities, adding support for task modules, and
improving targeted messaging and reactions. Additionally, it includes
some cleanup and configuration changes.

**Major new features and improvements:**

_Message handling and bot capabilities:_

* Added new message handlers in `TeamsBot/Program.cs` for commands such
as `help`, `targeted`, `react`, `card`, `feedback`, and `task`, each
demonstrating specific Teams bot features like targeted messages,
reactions, adaptive cards, and task modules.
[[1]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR19-R49)
[[2]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR122-R238)
* Introduced a detailed help handler that lists available message
patterns and commands, improving discoverability for users.
* Enhanced the catch-all handler to echo messages with a mention and
provide guidance to users.
* Improved lifecycle event handling by reordering and clarifying message
update and delete handlers.
[[1]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL118-R284)
[[2]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL158-R310)

_Task module support:_

* Added two new Adaptive Card definitions, `TaskModuleLauncherCard` and
`TaskModuleFormCard`, in `Cards.cs` to support task module dialogs.
* Implemented handlers for task module fetch and submit events, enabling
the bot to display a form in a dialog and process the submitted data.

_Targeted messaging and reactions:_

* Added handlers and logic to demonstrate sending, updating, and
deleting targeted messages, as well as adding and removing reactions to
messages, both in the main Teams bot sample and in the `CompatBot`
sample.
[[1]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR122-R238)
[[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL39-R93)

_Other improvements and cleanup:_

* Fixed the documentation URL for the Teams SDK in the citation handler.
* Updated `.gitignore` to exclude the `.claude/` directory.
* Removed the now-unnecessary `.claude/settings.local.json`
configuration file.
* Minor code cleanup and dependency ordering in
`RoutedTokenAcquisitionService.cs` and `EchoBot.cs`.
[[1]](diffhunk://#diff-49a16dd3d7f594e27c7dd21596874e089adf4f5f2fc7ef24a41f028035834163R4-L6)
[[2]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL11)
[[3]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL23-R22)

**References:**  

[[1]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR19-R49)
[[2]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bR122-R238)
[[3]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL118-R284)
[[4]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL158-R310)
[[5]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL178-R360)
[[6]](diffhunk://#diff-cc765b586b9be67733b494a4fdd0dffee5c3641f29ec07a1d4ddc0ebc0f709c8R61-R143)
[[7]](diffhunk://#diff-af85f59c6492668dca14d5f06b54cc2c3173708c83073e1d947b4c007dc851d6R4-R5)
[[8]](diffhunk://#diff-7c41c1a079a34ad9d167680c2029c93f0e4568a85e4ea589d96c0704bdce6e70L1-L8)
[[9]](diffhunk://#diff-49a16dd3d7f594e27c7dd21596874e089adf4f5f2fc7ef24a41f028035834163R4-L6)
[[10]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL11)
[[11]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL23-R22)
[[12]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL39-R93)
[[13]](diffhunk://#diff-691809f7a90c5bda6ee5e4335c2c393864a32101545fb0b35c24bc659623361bL78-R106)

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
**New StreamingBot sample:**

* Added the `StreamingBot` sample project to the solution and
implemented its main logic in `Program.cs`. The bot streams responses
from OpenAI, progressively updating the message in Teams and including
citations and adaptive cards.

**Streaming message support in Teams SDK:**

* Introduced the `TeamsStreamingWriter` class for managing streaming
message updates, supporting informative, intermediate, and final chunks,
and handling entities and attachments.
* Added the `GetStreamingWriter()` method to the `Context` class,
enabling easy creation of streaming writers in bot logic.

**Schema and serialization improvements:**

* Added the `TypingActivity` class to represent intermediate streaming
updates, including serialization support and integration into the
activity type system.
Key changes:
*  Channel shared, unshared, member added, member removed now working. 

**Sample Bot Event Handlers (TeamsChannelBot/Program.cs):** -> member
added, member removed, shared, unshared is registered once and in the
correct place. The `OnChannelRestored` handler remains commented out due
to lack of testability.

**Event Type Constants
(Schema/Activities/ConversationUpdateActivity.cs):** -> Fixed the casing
of the `ChannelUnShared` event constant to `channelUnshared` .
Introduce LoggerExtensions with LogInformationGuarded and
LogTraceGuarded to prevent expensive log message construction when not
enabled. Replace direct LogInformation and LogTrace calls with guarded
versions in core classes. Remove CA1873 suppression and update CA2227
justification. Improves logging performance and consistency.
- Added a new Adaptive Card for time off requests and updated the "card"
handler to use it.
- Introduced WelcomeMessageMiddleware to send a help message on first
interaction; refactored "help" handler to reuse this message.
- Improved "hello" handler to mention the user and show typing.
- Commented out the catch-all echo handler to reduce noise.
- Added OnMessageSubmitAction handler to process Adaptive Card
submissions.
- Minor cleanups: removed verbose logging and improved code structure.
This pull request introduces a new `SuggestedActions` feature for
message activities, enabling quick reply buttons and card actions in
Microsoft Teams bots. The changes include new schema classes, extension
methods for easier usage, and comprehensive unit tests to ensure correct
serialization, deserialization, and fluent API behavior.

**Schema and Serialization Enhancements:**

* Added new `CardAction` and `SuggestedActions` classes to represent
quick reply actions and their recipients, including common action types
as constants. (`core/src/Microsoft.Teams.Bot.Apps/Schema/CardAction.cs`,
`core/src/Microsoft.Teams.Bot.Apps/Schema/SuggestedActions.cs`)
[[1]](diffhunk://#diff-4c159b3af4206d04ce4994d2775b93613c4c5827d7183a55042b04bacad8af07R1-R131)
[[2]](diffhunk://#diff-ee8ce6b3eb82cc49311f75430d57fd1dd69a0feb1d781cbf2cbe7b3cdca5ba95R1-R68)
* Registered `CardAction` and `SuggestedActions` for JSON serialization
in `TeamsActivityJsonContext`.
(`core/src/Microsoft.Teams.Bot.Apps/Schema/TeamsActivityJsonContext.cs`)

**Integration with MessageActivity:**

* Integrated `SuggestedActions` property into `MessageActivity`,
including support for deserialization from JSON and removal of legacy
code.
(`core/src/Microsoft.Teams.Bot.Apps/Schema/Activities/MessageActivity.cs`)
[[1]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2R75-R86)
[[2]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2R138-R143)
[[3]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2L162-L164)
[[4]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2L266-L280)
[[5]](diffhunk://#diff-6f59d077bae6751d429a1458ffb982780671be62e09027244661405f0baad1a2R4)

**Developer Experience Improvements:**

* Added extension methods to simplify adding and chaining suggested
actions to message activities.
(`core/src/Microsoft.Teams.Bot.Apps/Schema/SuggestedActionsExtensions.cs`)

**Testing and Validation:**

* Introduced a comprehensive unit test suite to verify all aspects of
the new suggested actions feature, including serialization,
deserialization, fluent API, and extension methods.
(`core/test/Microsoft.Teams.Bot.Apps.UnitTests/SuggestedActionsTests.cs`)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reorganize Teams activity classes (e.g., MessageActivity,
InvokeActivity, EventActivity, etc.) from the Schema namespace into the
new Handlers namespace and file structure. Update all relevant usings
and references throughout the codebase. No functional changes—this
improves code organization and maintainability by clarifying the
separation between schema definitions and activity handlers. Also
includes minor clarity improvements in StreamingWriter.

One benefit of this organization for activities, is that make it clear
which activities are _incoming_ from the handlers, and which ones are
_outgoing_ in Schema.
1. Fix missing `RequireAuthorization` in CompatBot sample.
2. Refactor service collection setup.
3. Use `BotConfig` as single source for reading & propagating
configuration instead of doing that all over.
4. Move Msal setup logic to separate class
5. Support scenario where auth is not provided. Warning logs will be
emitted. Clients will be created without auth. Incomming token
validation will use a bypass scheme.

# Logs when setting up auth using the different config formats
## No credentials setup
<img width="1096" height="137" alt="image"
src="https://github.com/user-attachments/assets/8ed049bb-13a2-4858-9328-560696b34f6e"
/>

### Testing with Agents Plaground

<img width="1202" height="216" alt="image"
src="https://github.com/user-attachments/assets/3ca23613-e725-4fda-8d8a-7867185bce74"
/>

edit: it had multiple redundant logs before

## Msal Config setup
<img width="1098" height="179" alt="image"
src="https://github.com/user-attachments/assets/52ff919c-37bf-4077-8cbf-ce9db00cf1c8"
/>

## Core config setup

<img width="717" height="292" alt="image"
src="https://github.com/user-attachments/assets/2ce6adf6-0d3e-4abf-a986-185ea0bb1b99"
/>


## BF config setup

<img width="1049" height="291" alt="image"
src="https://github.com/user-attachments/assets/cdc80a0c-23af-43cc-afc6-408281d216db"
/>

---------

Co-authored-by: Rido <rido-min@users.noreply.github.com>
Update next/core with the latest changes from main
Fix Conflicts in Activity Client
…o body when sending an activity (#419)

**Null-safe Handling of Send Activity Responses:**

* Changed the return type of `SendAsync` in `ActivitiesApi.cs` to
`Task<SendActivityResponse?>`, allowing for null responses when the
service returns no body.
* Updated `TeamsStreamingWriter.cs` to handle potentially null
`SendActivityResponse` objects in both `SendInformativeUpdateAsync` and
`AppendResponseAsync`, ensuring `_streamId` is only set if a response is
present.
[[1]](diffhunk://#diff-19137d244f3805ddd4f0cb3a2f42577ca66bc85f7c8eabb4ab4b38a8e95f363eL75-R76)
[[2]](diffhunk://#diff-19137d244f3805ddd4f0cb3a2f42577ca66bc85f7c8eabb4ab4b38a8e95f363eL100-R101)
* Modified `CompatConversations.cs` to handle null
`SendActivityResponse` objects when replying to activities, defaulting
the resource response ID to an empty string if necessary.

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Upgraded Microsoft.AspNetCore.Authentication.* packages to 10.0.6 for
.NET 10.0. Updated Microsoft.Identity.Web.UI and AgentIdentities to
4.7.0. This ensures compatibility and includes the latest fixes and
improvements.
This pull request adds a new package dependency to the project to
support XML cryptography functionality across both .NET 8 and .NET 10
target frameworks.

Dependency updates:

* Added `System.Security.Cryptography.Xml` as a package reference for
both .NET 8 (`Version="8.0.3"`) and .NET 10 (`Version="10.0.6"`) in
`Microsoft.Teams.Bot.Core.csproj` to enable XML cryptography features.
This pull request introduces significant improvements to cloud
environment support and authentication flexibility in the Teams API SDK,
while also cleaning up legacy and experimental features. The main focus
is on enabling multi-cloud support (including USGov, DoD, and China)
through a new `CloudEnvironment` abstraction, updating authentication
flows to use cloud-specific endpoints, and ensuring that token and
service URLs are configurable and propagated across client instances.
Additionally, the pipeline configuration is modernized and consolidated.

**Cloud Environment & Authentication Enhancements**

* Introduced the `CloudEnvironment` class in `Microsoft.Teams.Api.Auth`,
encapsulating all cloud-specific endpoints, scopes, and service URLs,
with predefined instances for Public, USGov, USGovDoD, and China clouds,
and support for custom environments.
(`Libraries/Microsoft.Teams.Api/Auth/CloudEnvironment.cs`)
* Updated `ClientCredentials` to accept and use a `CloudEnvironment`
property, ensuring that all authentication requests (token endpoints,
tenants, etc.) are cloud-aware and configurable.
(`Libraries/Microsoft.Teams.Api/Auth/ClientCredentials.cs`)
[[1]](diffhunk://#diff-f4f1e221601dfbc876cf9ad54cede6b78a6e47d391a2c1c2da880d62d38e0b75R13)
[[2]](diffhunk://#diff-f4f1e221601dfbc876cf9ad54cede6b78a6e47d391a2c1c2da880d62d38e0b75L29-R32)

**Client Propagation of Cloud Settings**

* Modified `ApiClient` and related sub-clients to propagate
cloud-specific token service URLs and scopes, ensuring consistent
behavior when cloning or instantiating new clients with different
cancellation tokens.
(`Libraries/Microsoft.Teams.Api/Clients/ApiClient.cs`)
* Updated `BotSignInClient` to use a configurable `TokenServiceUrl`
property instead of a hardcoded URL, and applied this property in all
relevant API calls.
(`Libraries/Microsoft.Teams.Api/Clients/BotSignInClient.cs`)
[[1]](diffhunk://#diff-ead232105604b792e01c19dfe643c10410b2f05c1cfb6e9ba7010df63fa42750R10-R11)
[[2]](diffhunk://#diff-ead232105604b792e01c19dfe643c10410b2f05c1cfb6e9ba7010df63fa42750L35-R37)
[[3]](diffhunk://#diff-ead232105604b792e01c19dfe643c10410b2f05c1cfb6e9ba7010df63fa42750L47-R49)

**Pipeline Modernization**

* Migrated and consolidated the NuGet publishing pipeline to use the 1ES
Official Pipeline Template, supporting both internal and public
publishing, with improved security compliance and parameterization.
(`.azdo/publish.yaml`, `.azdo/publish.yml`)
[[1]](diffhunk://#diff-a07de71ec9283c8c83026a8a37c4f360f30d4e0d6890911cda3abb8ab01b5bc2R1-R227)
[[2]](diffhunk://#diff-186607033cddd78a2207f2b7acc82e3724148a6703c76d5f45f308a837c7e920L1-L87)

**Legacy/Experimental Cleanup**

* Removed the experimental `IsTargeted` property and related logic from
the `Activity` class, simplifying the activity model and removing
obsolete code paths.
(`Libraries/Microsoft.Teams.Api/Activities/Activity.cs`)
[[1]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aL149-L152)
[[2]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aL230-L237)
[[3]](diffhunk://#diff-875c3804dbdc89735553c417d023929c307dcfbead113a1b7a1e47871cab636aL443-L449)
This PR removes the dependency from Compat to TeamsApps, so we can
decouple the release date of Core/Compat from PA, from the FE release.

- Updates Compat Hosting to Add BotApplication instead of
TeamsBotApplication
- Updates CompatTeamsInfo to call each rest endpoint though the
ConversationClient.BotHttpClient Instance
- Remove some conversion from Core->Compat by using the proper generic
in the REST call


This pull request primarily migrates code from using the legacy
`TeamsBotApplication` and related types in the
`Microsoft.Teams.Bot.Apps` namespace to the newer `BotApplication` and
types from `Microsoft.Teams.Bot.Core`. It also removes or updates
compatibility methods that referenced the old schema, and modernizes
dependency registration and usage throughout the codebase. Additionally,
there are improvements to the handling of Teams channel account
conversions and group conversation logic in the sample bots.

**Migration to Bot Core and Cleanup:**

* Replaced all references to `TeamsBotApplication` with `BotApplication`
and updated constructor parameters and dependency injection
registrations accordingly in `CompatAdapter`, `CompatBotAdapter`,
`AdapterWithErrorHandler`, and related files.
(`[[1]](diffhunk://#diff-e6d701ce121dda6651c0dea00498d45e2cc0b0cec446a578f3058be691c7c0f5L26-R25)`,
`[[2]](diffhunk://#diff-e6d701ce121dda6651c0dea00498d45e2cc0b0cec446a578f3058be691c7c0f5L35-R34)`,
`[[3]](diffhunk://#diff-c443812ac75b10f0cb9e0929a1165dee72b7c96adbd232d830a65348ccd1b42bL28-R32)`,
`[[4]](diffhunk://#diff-e5922e6d5c7613f25aefa88e9c33d5a6c34be42d4353354e5f0e36f1715a0290L8-R16)`,
`[[5]](diffhunk://#diff-cb614beeb934fbb598ccac80c19a12a440f301b38b67b0e2796e861754fe59caL274-R280)`,
`[[6]](diffhunk://#diff-4a8e01c7cbf79ebf85f84bb4bef8cf1d3b02dc8a5875df6e9b34ac819fb7f80fL20-R20)`)
* Updated all using statements and type references from
`Microsoft.Teams.Bot.Apps` and `Microsoft.Teams.Bot.Apps.Schema` to
`Microsoft.Teams.Bot.Core` and `Microsoft.Teams.Bot.Core.Schema` as
appropriate.
(`[[1]](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL8-R11)`,
`[[2]](diffhunk://#diff-92ebcca71bdaad244e949c815cbf1152d5a3d814cc007052ae7ad2dd8ab225a9L8)`,
`[[3]](diffhunk://#diff-e6d701ce121dda6651c0dea00498d45e2cc0b0cec446a578f3058be691c7c0f5L9)`,
`[[4]](diffhunk://#diff-c443812ac75b10f0cb9e0929a1165dee72b7c96adbd232d830a65348ccd1b42bL9)`,
`[[5]](diffhunk://#diff-0317e1008e12e306d92289bc421d83933ace0400793ed8ad8abf13b03b68511eL7-R7)`)

**Dependency Injection and Service Registration:**

* Changed service registration in `InitCompatAdapter.cs` and
`CompatHostingExtensions.cs` to use `AddBotApplication` instead of
`AddTeamsBotApplication`, and updated singleton registrations to use
`BotApplication`.
(`[[1]](diffhunk://#diff-cb614beeb934fbb598ccac80c19a12a440f301b38b67b0e2796e861754fe59caL274-R280)`,
`[[2]](diffhunk://#diff-0317e1008e12e306d92289bc421d83933ace0400793ed8ad8abf13b03b68511eL45-R45)`)

**Schema and Compatibility Layer Updates:**

* Updated compatibility methods to use `ConversationAccount` from the
new core schema instead of legacy types, including the conversion logic
for Teams channel accounts.
(`[[1]](diffhunk://#diff-2b447b715e5c577302421ca232985ced9354b64def7b26219525758928d097daL427-L435)`,
`[[2]](diffhunk://#diff-92ebcca71bdaad244e949c815cbf1152d5a3d814cc007052ae7ad2dd8ab225a9L118-L204)`)
* Removed legacy compatibility methods for meeting info, meeting
participants, and channel info that referenced deprecated types.
(`[core/src/Microsoft.Teams.Bot.Compat/CompatActivity.csL118-L204](diffhunk://#diff-92ebcca71bdaad244e949c815cbf1152d5a3d814cc007052ae7ad2dd8ab225a9L118-L204)`)

**Bot Sample Improvements:**

* Enhanced the `EchoBot` sample to fetch and echo the user's display
name, and in group conversations, to retrieve and display team details
and paged member names using the new compatibility APIs.
(`[core/samples/CompatBot/EchoBot.csL37-R79](diffhunk://#diff-b9be640e365d9187b0d1a2021dddb84311b737f8c28b16428e3b2a450a4f331aL37-R79)`)

**Miscellaneous:**

* Added missing `System.Text.Json.Serialization` using directive in
`CompatTeamsInfo.Models.cs`.
(`[core/src/Microsoft.Teams.Bot.Compat/CompatTeamsInfo.Models.csR4](diffhunk://#diff-b1e303edd8e27c1011150ab48fe66a5de7f2e8ff54a6850a87efc57bcbd46583R4)`)

These changes modernize the codebase, improve maintainability, and
ensure compatibility with the latest Teams Bot SDK core components.
This is a RI to make sure next/core has no conflicts with main

---------

Co-authored-by: Shanmathi Mayuram Krithivasan <37715033+ShanmathiMayuramKrithivasan@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com>
Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Mehak Bindra <mhk0397@gmail.com>
Co-authored-by: Alex Acebo <aacebowork@gmail.com>
Co-authored-by: Kavin <115390646+singhk97@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Rajan <rajan.chari@yahoo.com>
Co-authored-by: Lily Du <lilyyduu@gmail.com>
Co-authored-by: lilydu <lilydu+odspmdb@microsoft.com>
This pull request makes significant improvements to the documentation
and API mapping for the Teams Bot compatibility layer, focusing on
clarifying the design and usage of the new `ApiClient` abstraction and
updating the mapping for Teams and batch APIs. The changes include a
comprehensive design document for `ApiClient`, a major rewrite of the
CompatTeamsInfo API mapping, and updates to deprecated warnings and
method routing. These updates provide clearer guidance for migrating to
the new architecture and highlight areas needing further work.

**ApiClient Design and Usage Documentation:**

- Added a detailed `ApiClient-Design.md` document describing the
architecture, sub-client structure, DI patterns, scoping via
`ForServiceUrl`, and delegation to core SDK clients. Includes diagrams,
method mapping tables, and integration details for handler and compat
layers.

**CompatTeamsInfo API Mapping Updates:**

- Rewrote `CompatTeamsInfo-API-Mapping.md` to:
  - Clarify which methods are implemented, deprecated, or pending.
- Update method routing to reflect usage of `ApiClient` sub-clients for
meetings and teams, and identify methods still requiring a new
`BatchClient`.
- Add a migration checklist, summarize type conversion strategies, and
clarify authentication/service URL handling.

**Deprecation and Method Routing:**

- Updated documentation to remove deprecated warning icons and instead
use explanatory notes for deprecated member/team methods, and clarified
the preferred paged alternatives.

**Testing and References:**

- Expanded testing documentation to specify test locations and required
environment variables, and improved references to supporting documents
and API sources.

**Project File Maintenance:**

- Minor update to the `core.slnx` solution file to remove the `Id`
attribute from the `Microsoft.Teams.Bot.Compat.csproj` entry, likely for
consistency or tooling compatibility.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Shanmathi Mayuram Krithivasan <37715033+ShanmathiMayuramKrithivasan@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com>
Co-authored-by: Corina <14900841+corinagum@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Mehak Bindra <mhk0397@gmail.com>
Co-authored-by: Alex Acebo <aacebowork@gmail.com>
Co-authored-by: Kavin <115390646+singhk97@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Rajan <rajan.chari@yahoo.com>
Co-authored-by: Lily Du <lilyyduu@gmail.com>
Co-authored-by: lilydu <lilydu+odspmdb@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants