diff --git a/.github/workflows/dotnet-build-and-test.yml b/.github/workflows/dotnet-build-and-test.yml index ecf093a3e9..97d1d60b3a 100644 --- a/.github/workflows/dotnet-build-and-test.yml +++ b/.github/workflows/dotnet-build-and-test.yml @@ -18,6 +18,7 @@ on: env: COVERAGE_THRESHOLD: 80 + COVERAGE_FRAMEWORK: net10.0 # framework target for which we run/report code coverage concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -59,9 +60,9 @@ jobs: fail-fast: false matrix: include: - - { targetFramework: "net9.0", os: "ubuntu-latest", configuration: Release, integration-tests: true, environment: "integration" } - - { targetFramework: "net9.0", os: "ubuntu-latest", configuration: Debug } - - { targetFramework: "net9.0", os: "windows-latest", configuration: Release } + - { targetFramework: "net10.0", os: "ubuntu-latest", configuration: Release, integration-tests: true, environment: "integration" } + - { targetFramework: "net9.0", os: "windows-latest", configuration: Debug } + - { targetFramework: "net8.0", os: "ubuntu-latest", configuration: Release } - { targetFramework: "net472", os: "windows-latest", configuration: Release, integration-tests: true, environment: "integration" } runs-on: ${{ matrix.os }} @@ -69,13 +70,13 @@ jobs: steps: - uses: actions/checkout@v5 with: - persist-credentials: false - sparse-checkout: | - . - .github - dotnet - python - workflow-samples + persist-credentials: false + sparse-checkout: | + . + .github + dotnet + python + workflow-samples - name: Setup dotnet uses: actions/setup-dotnet@v5.0.0 @@ -123,7 +124,7 @@ jobs: popd rm -rf "$TEMP_DIR" - - name: Run Unit Tests Windows + - name: Run Unit Tests shell: bash run: | export UT_PROJECTS=$(find ./dotnet -type f -name "*.UnitTests.csproj" | tr '\n' ' ') @@ -133,12 +134,16 @@ jobs: # Check if the project supports the target framework if [[ "$target_frameworks" == *"${{ matrix.targetFramework }}"* ]]; then - dotnet test -f ${{ matrix.targetFramework }} -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx --collect:"XPlat Code Coverage" --results-directory:"TestResults/Coverage/" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByAttribute=GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute + if [[ "${{ matrix.targetFramework }}" == "${{ env.COVERAGE_FRAMEWORK }}" ]]; then + dotnet test -f ${{ matrix.targetFramework }} -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx --collect:"XPlat Code Coverage" --results-directory:"TestResults/Coverage/" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByAttribute=GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute + else + dotnet test -f ${{ matrix.targetFramework }} -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx + fi else echo "Skipping $project - does not support target framework ${{ matrix.targetFramework }} (supports: $target_frameworks)" fi done - + - name: Log event name and matrix integration-tests shell: bash run: echo "github.event_name:${{ github.event_name }} matrix.integration-tests:${{ matrix.integration-tests }} github.event.action:${{ github.event.action }} github.event.pull_request.merged:${{ github.event.pull_request.merged }}" @@ -194,6 +199,7 @@ jobs: # Generate test reports and check coverage - name: Generate test reports + if: matrix.targetFramework == env.COVERAGE_FRAMEWORK uses: danielpalme/ReportGenerator-GitHub-Action@5.4.18 with: reports: "./TestResults/Coverage/**/coverage.cobertura.xml" @@ -201,12 +207,14 @@ jobs: reporttypes: "HtmlInline;JsonSummary" - name: Upload coverage report artifact + if: matrix.targetFramework == env.COVERAGE_FRAMEWORK uses: actions/upload-artifact@v5 with: name: CoverageReport-${{ matrix.os }}-${{ matrix.targetFramework }}-${{ matrix.configuration }} # Artifact name path: ./TestResults/Reports # Directory containing files to upload - name: Check coverage + if: matrix.targetFramework == env.COVERAGE_FRAMEWORK shell: pwsh run: .github/workflows/dotnet-check-coverage.ps1 -JsonReportPath "TestResults/Reports/Summary.json" -CoverageThreshold $env:COVERAGE_THRESHOLD diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index a9fe090013..757d877028 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -22,7 +22,7 @@ jobs: fail-fast: false matrix: include: - - { dotnet: "9.0", configuration: Release, os: ubuntu-latest } + - { dotnet: "10.0", configuration: Release, os: ubuntu-latest } runs-on: ${{ matrix.os }} env: diff --git a/TRANSPARENCY_FAQ.md b/TRANSPARENCY_FAQ.md index cd850ff796..8fc8c23aec 100644 --- a/TRANSPARENCY_FAQ.md +++ b/TRANSPARENCY_FAQ.md @@ -42,7 +42,7 @@ Microsoft Agent Framework relies on existing LLMs. Using the framework retains c **Framework-Specific Limitations**: -- **Platform Requirements**: Python 3.10+ required, specific .NET versions (.NET 8.0, 9.0, netstandard2.0, net472) +- **Platform Requirements**: Python 3.10+ required, specific .NET versions (.NET 8.0, 9.0, 10.0, netstandard2.0, net472) - **API Dependencies**: Requires proper configuration of LLM provider keys and endpoints - **Orchestration Features**: Advanced orchestration patterns like GroupChat, Sequential, and Concurrent orchestrations are "coming soon" for Python implementation - **Privacy and Data Protection**: The framework allows for human participation in conversations between agents. It is important to ensure that user data and conversations are protected and that developers use appropriate measures to safeguard privacy. diff --git a/dotnet/Directory.Build.props b/dotnet/Directory.Build.props index 6b61196bbd..b862c85072 100644 --- a/dotnet/Directory.Build.props +++ b/dotnet/Directory.Build.props @@ -6,14 +6,12 @@ AllEnabledByDefault latest true - 13 + latest enable $(NoWarn);NU5128 true - net9.0;net8.0 - net9.0 - net9.0;net8.0;netstandard2.0;net472 - net9.0;net472 + net10.0;net9.0;net8.0 + $(TargetFrameworksCore);netstandard2.0;net472 true Debug;Release;Publish diff --git a/dotnet/Directory.Build.targets b/dotnet/Directory.Build.targets index 75033d16e3..5e62f1cef7 100644 --- a/dotnet/Directory.Build.targets +++ b/dotnet/Directory.Build.targets @@ -5,7 +5,7 @@ - + diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index 00f10230a5..8ef93b3072 100644 --- a/dotnet/Directory.Packages.props +++ b/dotnet/Directory.Packages.props @@ -48,7 +48,7 @@ - + @@ -80,11 +80,11 @@ - + - - + + @@ -117,11 +117,11 @@ - - - + + + diff --git a/dotnet/global.json b/dotnet/global.json index 402d97f665..54533bf771 100644 --- a/dotnet/global.json +++ b/dotnet/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "9.0.300", - "rollForward": "latestMajor", + "version": "10.0.100", + "rollForward": "minor", "allowPrerelease": false } } \ No newline at end of file diff --git a/dotnet/samples/A2AClientServer/A2AClient/A2AClient.csproj b/dotnet/samples/A2AClientServer/A2AClient/A2AClient.csproj index 77a0588231..f67de8ff79 100644 --- a/dotnet/samples/A2AClientServer/A2AClient/A2AClient.csproj +++ b/dotnet/samples/A2AClientServer/A2AClient/A2AClient.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable 5ee045b0-aea3-4f08-8d31-32d1a6f8fed0 @@ -12,8 +12,11 @@ - - + + + + + diff --git a/dotnet/samples/A2AClientServer/A2AServer/A2AServer.csproj b/dotnet/samples/A2AClientServer/A2AServer/A2AServer.csproj index 8d67180f64..0a3b170a0b 100644 --- a/dotnet/samples/A2AClientServer/A2AServer/A2AServer.csproj +++ b/dotnet/samples/A2AClientServer/A2AServer/A2AServer.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable 5ee045b0-aea3-4f08-8d31-32d1a6f8fed0 @@ -11,8 +11,11 @@ - - + + + + + diff --git a/dotnet/samples/A2AClientServer/README.md b/dotnet/samples/A2AClientServer/README.md index 8bf5fc5816..04b9968e76 100644 --- a/dotnet/samples/A2AClientServer/README.md +++ b/dotnet/samples/A2AClientServer/README.md @@ -103,7 +103,7 @@ dotnet run --urls "http://localhost:5002;https://localhost:5012" --agentId " Exe - net9.0 + net10.0 enable enable a8b2e9f0-1ea3-4f18-9d41-42d1a6f8fe10 @@ -11,8 +11,6 @@ - - diff --git a/dotnet/samples/AGUIClientServer/AGUIClient/Program.cs b/dotnet/samples/AGUIClientServer/AGUIClient/Program.cs index 0cbf15d6e4..3079bf1451 100644 --- a/dotnet/samples/AGUIClientServer/AGUIClient/Program.cs +++ b/dotnet/samples/AGUIClientServer/AGUIClient/Program.cs @@ -201,12 +201,12 @@ private static string PrintArguments(IDictionary? arguments) { return ""; } - var builder = new StringBuilder(); - builder.AppendLine(); + var builder = new StringBuilder().AppendLine(); foreach (var kvp in arguments) { - builder.AppendLine($" Name: {kvp.Key}"); - builder.AppendLine($" Value: {kvp.Value}"); + builder + .AppendLine($" Name: {kvp.Key}") + .AppendLine($" Value: {kvp.Value}"); } return builder.ToString(); } diff --git a/dotnet/samples/AGUIClientServer/AGUIDojoServer/AGUIDojoServer.csproj b/dotnet/samples/AGUIClientServer/AGUIDojoServer/AGUIDojoServer.csproj index 0513374a93..cea8efff76 100644 --- a/dotnet/samples/AGUIClientServer/AGUIDojoServer/AGUIDojoServer.csproj +++ b/dotnet/samples/AGUIClientServer/AGUIDojoServer/AGUIDojoServer.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable b9c3f1e1-2fb4-5g29-0e52-53e2b7g9gf21 @@ -11,8 +11,6 @@ - - diff --git a/dotnet/samples/AGUIClientServer/AGUIDojoServer/Program.cs b/dotnet/samples/AGUIClientServer/AGUIDojoServer/Program.cs index 57cc409c58..7e9ccca9b9 100644 --- a/dotnet/samples/AGUIClientServer/AGUIDojoServer/Program.cs +++ b/dotnet/samples/AGUIClientServer/AGUIDojoServer/Program.cs @@ -42,4 +42,4 @@ await app.RunAsync(); -public partial class Program { } +public partial class Program; diff --git a/dotnet/samples/AGUIClientServer/AGUIServer/AGUIServer.csproj b/dotnet/samples/AGUIClientServer/AGUIServer/AGUIServer.csproj index c1bcd511da..ccfe22923a 100644 --- a/dotnet/samples/AGUIClientServer/AGUIServer/AGUIServer.csproj +++ b/dotnet/samples/AGUIClientServer/AGUIServer/AGUIServer.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable a8b2e9f0-1ea3-4f18-9d41-42d1a6f8fe10 @@ -11,8 +11,6 @@ - - diff --git a/dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/AgentWebChat.AgentHost.csproj b/dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/AgentWebChat.AgentHost.csproj index b4141ba166..3f2a832a69 100644 --- a/dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/AgentWebChat.AgentHost.csproj +++ b/dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/AgentWebChat.AgentHost.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable true @@ -31,11 +31,4 @@ - - - - - - - \ No newline at end of file diff --git a/dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/Custom/CustomAITools.cs b/dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/Custom/CustomAITools.cs index d3deb9162c..14f0bcee41 100644 --- a/dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/Custom/CustomAITools.cs +++ b/dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/Custom/CustomAITools.cs @@ -4,9 +4,7 @@ namespace AgentWebChat.AgentHost.Custom; -public class CustomAITool : AITool -{ -} +public class CustomAITool : AITool; public class CustomFunctionTool : AIFunction { diff --git a/dotnet/samples/AgentWebChat/AgentWebChat.AppHost/AgentWebChat.AppHost.csproj b/dotnet/samples/AgentWebChat/AgentWebChat.AppHost/AgentWebChat.AppHost.csproj index 464ba54db8..de87c119ec 100644 --- a/dotnet/samples/AgentWebChat/AgentWebChat.AppHost/AgentWebChat.AppHost.csproj +++ b/dotnet/samples/AgentWebChat/AgentWebChat.AppHost/AgentWebChat.AppHost.csproj @@ -4,7 +4,7 @@ Exe - net9.0 + net10.0 enable enable true diff --git a/dotnet/samples/AgentWebChat/AgentWebChat.ServiceDefaults/AgentWebChat.ServiceDefaults.csproj b/dotnet/samples/AgentWebChat/AgentWebChat.ServiceDefaults/AgentWebChat.ServiceDefaults.csproj index 09110f11ad..0c5573beac 100644 --- a/dotnet/samples/AgentWebChat/AgentWebChat.ServiceDefaults/AgentWebChat.ServiceDefaults.csproj +++ b/dotnet/samples/AgentWebChat/AgentWebChat.ServiceDefaults/AgentWebChat.ServiceDefaults.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable true diff --git a/dotnet/samples/AgentWebChat/AgentWebChat.Web/A2AAgentClient.cs b/dotnet/samples/AgentWebChat/AgentWebChat.Web/A2AAgentClient.cs index db690950da..08dafea129 100644 --- a/dotnet/samples/AgentWebChat/AgentWebChat.Web/A2AAgentClient.cs +++ b/dotnet/samples/AgentWebChat/AgentWebChat.Web/A2AAgentClient.cs @@ -25,7 +25,7 @@ public A2AAgentClient(ILogger logger, Uri baseUri) this._uri = baseUri; } - public async override IAsyncEnumerable RunStreamingAsync( + public override async IAsyncEnumerable RunStreamingAsync( string agentName, IList messages, string? threadId = null, @@ -122,7 +122,7 @@ public async override IAsyncEnumerable RunStreamingAsync } } - public async override Task GetAgentCardAsync(string agentName, CancellationToken cancellationToken = default) + public override async Task GetAgentCardAsync(string agentName, CancellationToken cancellationToken = default) { this._logger.LogInformation("Retrieving agent card for {Agent}", agentName); diff --git a/dotnet/samples/AgentWebChat/AgentWebChat.Web/AgentWebChat.Web.csproj b/dotnet/samples/AgentWebChat/AgentWebChat.Web/AgentWebChat.Web.csproj index 72541f046f..fd26f56191 100644 --- a/dotnet/samples/AgentWebChat/AgentWebChat.Web/AgentWebChat.Web.csproj +++ b/dotnet/samples/AgentWebChat/AgentWebChat.Web/AgentWebChat.Web.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable $(NoWarn);CA1812 @@ -15,11 +15,4 @@ - - - - - - - diff --git a/dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIChatCompletionsAgentClient.cs b/dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIChatCompletionsAgentClient.cs index ae71a87678..95e3d16fd4 100644 --- a/dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIChatCompletionsAgentClient.cs +++ b/dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIChatCompletionsAgentClient.cs @@ -16,7 +16,7 @@ namespace AgentWebChat.Web; /// internal sealed class OpenAIChatCompletionsAgentClient(HttpClient httpClient) : AgentClientBase { - public async override IAsyncEnumerable RunStreamingAsync( + public override async IAsyncEnumerable RunStreamingAsync( string agentName, IList messages, string? threadId = null, diff --git a/dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIResponsesAgentClient.cs b/dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIResponsesAgentClient.cs index bb7f6c151c..7cc85b97c3 100644 --- a/dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIResponsesAgentClient.cs +++ b/dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIResponsesAgentClient.cs @@ -15,7 +15,7 @@ namespace AgentWebChat.Web; /// internal sealed class OpenAIResponsesAgentClient(HttpClient httpClient) : AgentClientBase { - public async override IAsyncEnumerable RunStreamingAsync( + public override async IAsyncEnumerable RunStreamingAsync( string agentName, IList messages, string? threadId = null, diff --git a/dotnet/samples/AzureFunctions/01_SingleAgent/01_SingleAgent.csproj b/dotnet/samples/AzureFunctions/01_SingleAgent/01_SingleAgent.csproj index bce1b96f7b..99f78cc1ab 100644 --- a/dotnet/samples/AzureFunctions/01_SingleAgent/01_SingleAgent.csproj +++ b/dotnet/samples/AzureFunctions/01_SingleAgent/01_SingleAgent.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 v4 Exe enable diff --git a/dotnet/samples/AzureFunctions/02_AgentOrchestration_Chaining/02_AgentOrchestration_Chaining.csproj b/dotnet/samples/AzureFunctions/02_AgentOrchestration_Chaining/02_AgentOrchestration_Chaining.csproj index 4ec460450a..af6fe8bcde 100644 --- a/dotnet/samples/AzureFunctions/02_AgentOrchestration_Chaining/02_AgentOrchestration_Chaining.csproj +++ b/dotnet/samples/AzureFunctions/02_AgentOrchestration_Chaining/02_AgentOrchestration_Chaining.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 v4 Exe enable diff --git a/dotnet/samples/AzureFunctions/03_AgentOrchestration_Concurrency/03_AgentOrchestration_Concurrency.csproj b/dotnet/samples/AzureFunctions/03_AgentOrchestration_Concurrency/03_AgentOrchestration_Concurrency.csproj index 8698b0a7b8..394bf9cc35 100644 --- a/dotnet/samples/AzureFunctions/03_AgentOrchestration_Concurrency/03_AgentOrchestration_Concurrency.csproj +++ b/dotnet/samples/AzureFunctions/03_AgentOrchestration_Concurrency/03_AgentOrchestration_Concurrency.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 v4 Exe enable diff --git a/dotnet/samples/AzureFunctions/03_AgentOrchestration_Concurrency/Program.cs b/dotnet/samples/AzureFunctions/03_AgentOrchestration_Concurrency/Program.cs index d4d5750df7..5a6fbaf203 100644 --- a/dotnet/samples/AzureFunctions/03_AgentOrchestration_Concurrency/Program.cs +++ b/dotnet/samples/AzureFunctions/03_AgentOrchestration_Concurrency/Program.cs @@ -36,8 +36,9 @@ .ConfigureFunctionsWebApplication() .ConfigureDurableAgents(options => { - options.AddAIAgent(physicistAgent); - options.AddAIAgent(chemistAgent); + options + .AddAIAgent(physicistAgent) + .AddAIAgent(chemistAgent); }) .Build(); diff --git a/dotnet/samples/AzureFunctions/04_AgentOrchestration_Conditionals/04_AgentOrchestration_Conditionals.csproj b/dotnet/samples/AzureFunctions/04_AgentOrchestration_Conditionals/04_AgentOrchestration_Conditionals.csproj index 1971fb164a..8dc1832227 100644 --- a/dotnet/samples/AzureFunctions/04_AgentOrchestration_Conditionals/04_AgentOrchestration_Conditionals.csproj +++ b/dotnet/samples/AzureFunctions/04_AgentOrchestration_Conditionals/04_AgentOrchestration_Conditionals.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 v4 Exe enable diff --git a/dotnet/samples/AzureFunctions/04_AgentOrchestration_Conditionals/Program.cs b/dotnet/samples/AzureFunctions/04_AgentOrchestration_Conditionals/Program.cs index e63d1a9667..971f862f21 100644 --- a/dotnet/samples/AzureFunctions/04_AgentOrchestration_Conditionals/Program.cs +++ b/dotnet/samples/AzureFunctions/04_AgentOrchestration_Conditionals/Program.cs @@ -39,8 +39,9 @@ .ConfigureFunctionsWebApplication() .ConfigureDurableAgents(options => { - options.AddAIAgent(spamDetectionAgent); - options.AddAIAgent(emailAssistantAgent); + options + .AddAIAgent(spamDetectionAgent) + .AddAIAgent(emailAssistantAgent); }) .Build(); diff --git a/dotnet/samples/AzureFunctions/05_AgentOrchestration_HITL/05_AgentOrchestration_HITL.csproj b/dotnet/samples/AzureFunctions/05_AgentOrchestration_HITL/05_AgentOrchestration_HITL.csproj index b7d211605f..a240ea0394 100644 --- a/dotnet/samples/AzureFunctions/05_AgentOrchestration_HITL/05_AgentOrchestration_HITL.csproj +++ b/dotnet/samples/AzureFunctions/05_AgentOrchestration_HITL/05_AgentOrchestration_HITL.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 v4 Exe enable diff --git a/dotnet/samples/AzureFunctions/06_LongRunningTools/06_LongRunningTools.csproj b/dotnet/samples/AzureFunctions/06_LongRunningTools/06_LongRunningTools.csproj index f6e6b7bbfc..8711331aa2 100644 --- a/dotnet/samples/AzureFunctions/06_LongRunningTools/06_LongRunningTools.csproj +++ b/dotnet/samples/AzureFunctions/06_LongRunningTools/06_LongRunningTools.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 v4 Exe enable diff --git a/dotnet/samples/AzureFunctions/07_AgentAsMcpTool/07_AgentAsMcpTool.csproj b/dotnet/samples/AzureFunctions/07_AgentAsMcpTool/07_AgentAsMcpTool.csproj index 8fa1f5f2e7..12795b2efb 100644 --- a/dotnet/samples/AzureFunctions/07_AgentAsMcpTool/07_AgentAsMcpTool.csproj +++ b/dotnet/samples/AzureFunctions/07_AgentAsMcpTool/07_AgentAsMcpTool.csproj @@ -1,6 +1,6 @@  - net9.0 + net10.0 v4 Exe enable diff --git a/dotnet/samples/AzureFunctions/README.md b/dotnet/samples/AzureFunctions/README.md index 83d26a53b7..e60b0f662e 100644 --- a/dotnet/samples/AzureFunctions/README.md +++ b/dotnet/samples/AzureFunctions/README.md @@ -18,7 +18,7 @@ These samples are designed to be run locally in a cloned repository. The following prerequisites are required to run the samples: -- [.NET 9.0 SDK or later](https://dotnet.microsoft.com/download/dotnet) +- [.NET 10.0 SDK or later](https://dotnet.microsoft.com/download/dotnet) - [Azure Functions Core Tools](https://learn.microsoft.com/azure/azure-functions/functions-run-local) (version 4.x or later) - [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) installed and authenticated (`az login`) or an API key for the Azure OpenAI service - [Azure OpenAI Service](https://learn.microsoft.com/azure/ai-services/openai/how-to/create-resource) with a deployed model (gpt-4o-mini or better is recommended) diff --git a/dotnet/samples/Directory.Build.props b/dotnet/samples/Directory.Build.props index dd86677c3e..15880d4a8e 100644 --- a/dotnet/samples/Directory.Build.props +++ b/dotnet/samples/Directory.Build.props @@ -5,7 +5,7 @@ false false - net472;net9.0 + net10.0;net472 5ee045b0-aea3-4f08-8d31-32d1a6f8fed0 diff --git a/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/A2AAgent_AsFunctionTools.csproj b/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/A2AAgent_AsFunctionTools.csproj index 2b89b20fbf..940c9a313a 100644 --- a/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/A2AAgent_AsFunctionTools.csproj +++ b/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/A2AAgent_AsFunctionTools.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -13,8 +13,11 @@ - - + + + + + diff --git a/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/README.md b/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/README.md index 6cbd56dca4..c050ad0830 100644 --- a/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/README.md +++ b/dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/README.md @@ -7,7 +7,7 @@ and register these function tools with another AI agent so it can leverage the A Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Access to the A2A agent host service **Note**: These samples need to be run against a valid A2A server. If no A2A server is available, they can be run against the echo-agent that can be diff --git a/dotnet/samples/GettingStarted/AgentOpenTelemetry/AgentOpenTelemetry.csproj b/dotnet/samples/GettingStarted/AgentOpenTelemetry/AgentOpenTelemetry.csproj index f9b7b3da2a..e194fec9c2 100644 --- a/dotnet/samples/GettingStarted/AgentOpenTelemetry/AgentOpenTelemetry.csproj +++ b/dotnet/samples/GettingStarted/AgentOpenTelemetry/AgentOpenTelemetry.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -22,7 +22,6 @@ - diff --git a/dotnet/samples/GettingStarted/AgentOpenTelemetry/README.md b/dotnet/samples/GettingStarted/AgentOpenTelemetry/README.md index 8f675a20d1..229d37dca6 100644 --- a/dotnet/samples/GettingStarted/AgentOpenTelemetry/README.md +++ b/dotnet/samples/GettingStarted/AgentOpenTelemetry/README.md @@ -22,7 +22,7 @@ graph TD ## Prerequisites -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure OpenAI service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) - Docker installed (for running Aspire Dashboard) @@ -71,7 +71,7 @@ If you prefer to run the components manually: #### Step 1: Start the Aspire Dashboard via Docker ```powershell -docker run -d --name aspire-dashboard -p 4318:18888 -p 4317:18889 -e DOTNET_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS=true mcr.microsoft.com/dotnet/aspire-dashboard:9.0 +docker run -d --name aspire-dashboard -p 4318:18888 -p 4317:18889 -e DOTNET_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS=true mcr.microsoft.com/dotnet/aspire-dashboard:latest ``` #### Step 2: Access the Dashboard @@ -207,7 +207,7 @@ If you encounter port binding errors, try: - Ensure the Azure OpenAI deployment name matches your actual deployment ### Build Issues -- Ensure you're using .NET 9.0 SDK +- Ensure you're using .NET 10.0 SDK - Run `dotnet restore` if you encounter package restore issues - Check that all project references are correctly resolved diff --git a/dotnet/samples/GettingStarted/AgentOpenTelemetry/start-demo.ps1 b/dotnet/samples/GettingStarted/AgentOpenTelemetry/start-demo.ps1 index 8445d1e7e3..7af1c9d8ae 100644 --- a/dotnet/samples/GettingStarted/AgentOpenTelemetry/start-demo.ps1 +++ b/dotnet/samples/GettingStarted/AgentOpenTelemetry/start-demo.ps1 @@ -65,7 +65,7 @@ $dockerResult = docker run -d ` -p 4317:18889 ` -e DOTNET_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS=true ` --restart unless-stopped ` - mcr.microsoft.com/dotnet/aspire-dashboard:9.0 + mcr.microsoft.com/dotnet/aspire-dashboard:latest if ($LASTEXITCODE -ne 0) { Write-Host "Failed to start Aspire Dashboard container" -ForegroundColor Red diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_A2A/Agent_With_A2A.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_A2A/Agent_With_A2A.csproj index e01a9f7458..7236ee5044 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_A2A/Agent_With_A2A.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_A2A/Agent_With_A2A.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -10,8 +10,6 @@ - - diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_A2A/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_A2A/README.md index ce7a9174b0..536514306e 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_A2A/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_A2A/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Access to the A2A agent host service **Note**: These samples need to be run against a valid A2A server. If no A2A server is available, they can be run against the echo-agent that can be spun up locally by following the guidelines at: https://github.com/a2aproject/a2a-dotnet/blob/main/samples/AgentServer/README.md diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIAgentsPersistent/Agent_With_AzureAIAgentsPersistent.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIAgentsPersistent/Agent_With_AzureAIAgentsPersistent.csproj index 11c7beb3bf..d40e93232b 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIAgentsPersistent/Agent_With_AzureAIAgentsPersistent.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIAgentsPersistent/Agent_With_AzureAIAgentsPersistent.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIAgentsPersistent/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIAgentsPersistent/README.md index df0854ba2f..9e981de64b 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIAgentsPersistent/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIAgentsPersistent/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/Agent_With_AzureAIProject.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/Agent_With_AzureAIProject.csproj index 057a0fc507..a8deaa57b5 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/Agent_With_AzureAIProject.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/Agent_With_AzureAIProject.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/README.md index df0854ba2f..9e981de64b 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureFoundryModel/Agent_With_AzureFoundryModel.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureFoundryModel/Agent_With_AzureFoundryModel.csproj index cd545ddb48..0c4701fafd 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureFoundryModel/Agent_With_AzureFoundryModel.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureFoundryModel/Agent_With_AzureFoundryModel.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureFoundryModel/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureFoundryModel/README.md index 9147bda1da..cff8767770 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureFoundryModel/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureFoundryModel/README.md @@ -10,7 +10,7 @@ You could use models from Microsoft, OpenAI, DeepSeek, Hugging Face, Meta, xAI o Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure AI Foundry resource - A model deployment in your Azure AI Foundry resource. This example defaults to using the `Phi-4-mini-instruct` model, so if you want to use a different model, ensure that you set your `AZURE_FOUNDRY_MODEL_DEPLOYMENT` environment diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/Agent_With_AzureOpenAIChatCompletion.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/Agent_With_AzureOpenAIChatCompletion.csproj index 0eacdab258..41aafe3437 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/Agent_With_AzureOpenAIChatCompletion.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/Agent_With_AzureOpenAIChatCompletion.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/README.md index 1278eb59e5..4cacf30131 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure OpenAI service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/Agent_With_AzureOpenAIResponses.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/Agent_With_AzureOpenAIResponses.csproj index 0eacdab258..41aafe3437 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/Agent_With_AzureOpenAIResponses.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/Agent_With_AzureOpenAIResponses.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/README.md index 1278eb59e5..4cacf30131 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure OpenAI service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Agent_With_CustomImplementation.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Agent_With_CustomImplementation.csproj index aa1c382aef..945912bfd4 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Agent_With_CustomImplementation.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Agent_With_CustomImplementation.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_ONNX/Agent_With_ONNX.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_ONNX/Agent_With_ONNX.csproj index c4a9467179..61acc80e9c 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_ONNX/Agent_With_ONNX.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_ONNX/Agent_With_ONNX.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_ONNX/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_ONNX/README.md index cb86e0d7c4..d97b0075ac 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_ONNX/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_ONNX/README.md @@ -4,7 +4,7 @@ WARNING: ONNX doesn't support function calling, so any function tools passed to Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - An ONNX model downloaded to your machine You can download an ONNX model from hugging face, using git clone: diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_Ollama/Agent_With_Ollama.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_Ollama/Agent_With_Ollama.csproj index 1ad175831b..c538cbedd1 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_Ollama/Agent_With_Ollama.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_Ollama/Agent_With_Ollama.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_Ollama/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_Ollama/README.md index be76a75de0..d448f31d65 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_Ollama/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_Ollama/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Docker installed and running on your machine - An Ollama model downloaded into Ollama diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Agent_With_OpenAIAssistants.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Agent_With_OpenAIAssistants.csproj index 0629a84bd0..eeda3eef6f 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Agent_With_OpenAIAssistants.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Agent_With_OpenAIAssistants.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/README.md index 22a4bae18c..ad2b8e14d9 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/README.md @@ -5,7 +5,7 @@ For more information see the OpenAI documentation: https://platform.openai.com/d Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - OpenAI API key Set the following environment variables: diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIChatCompletion/Agent_With_OpenAIChatCompletion.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIChatCompletion/Agent_With_OpenAIChatCompletion.csproj index 0629a84bd0..eeda3eef6f 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIChatCompletion/Agent_With_OpenAIChatCompletion.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIChatCompletion/Agent_With_OpenAIChatCompletion.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIChatCompletion/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIChatCompletion/README.md index 80b63e7cd0..4df942f676 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIChatCompletion/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIChatCompletion/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - OpenAI api key Set the following environment variables: diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIResponses/Agent_With_OpenAIResponses.csproj b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIResponses/Agent_With_OpenAIResponses.csproj index 0629a84bd0..eeda3eef6f 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIResponses/Agent_With_OpenAIResponses.csproj +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIResponses/Agent_With_OpenAIResponses.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIResponses/README.md b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIResponses/README.md index 80b63e7cd0..4df942f676 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIResponses/README.md +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIResponses/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - OpenAI api key Set the following environment variables: diff --git a/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step01_ChatHistoryMemory/AgentWithMemory_Step01_ChatHistoryMemory.csproj b/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step01_ChatHistoryMemory/AgentWithMemory_Step01_ChatHistoryMemory.csproj index 1caf270c49..860089b621 100644 --- a/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step01_ChatHistoryMemory/AgentWithMemory_Step01_ChatHistoryMemory.csproj +++ b/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step01_ChatHistoryMemory/AgentWithMemory_Step01_ChatHistoryMemory.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -13,7 +13,6 @@ - diff --git a/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/AgentWithMemory_Step02_MemoryUsingMem0.csproj b/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/AgentWithMemory_Step02_MemoryUsingMem0.csproj index 9d7aa41a99..1e0863d66f 100644 --- a/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/AgentWithMemory_Step02_MemoryUsingMem0.csproj +++ b/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/AgentWithMemory_Step02_MemoryUsingMem0.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/Program.cs b/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/Program.cs index 539ebbaecb..feacead4dd 100644 --- a/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/Program.cs +++ b/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/Program.cs @@ -31,7 +31,7 @@ .CreateAIAgent(new ChatClientAgentOptions() { Instructions = "You are a friendly travel assistant. Use known memories about the user when responding, and do not invent details.", - AIContextProviderFactory = ctx => ctx.SerializedState.ValueKind is not JsonValueKind.Null or JsonValueKind.Undefined + AIContextProviderFactory = ctx => ctx.SerializedState.ValueKind is not JsonValueKind.Null and not JsonValueKind.Undefined // If each thread should have its own Mem0 scope, you can create a new id per thread here: // ? new Mem0Provider(mem0HttpClient, new Mem0ProviderScope() { ThreadId = Guid.NewGuid().ToString() }) // In this case we are storing memories scoped by application and user instead so that memories are retained across threads. diff --git a/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step03_CustomMemory/AgentWithMemory_Step03_CustomMemory.csproj b/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step03_CustomMemory/AgentWithMemory_Step03_CustomMemory.csproj index 8298cfe6e8..0f9de7c359 100644 --- a/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step03_CustomMemory/AgentWithMemory_Step03_CustomMemory.csproj +++ b/dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step03_CustomMemory/AgentWithMemory_Step03_CustomMemory.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step01_Running/Agent_OpenAI_Step01_Running.csproj b/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step01_Running/Agent_OpenAI_Step01_Running.csproj index 0629a84bd0..eeda3eef6f 100644 --- a/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step01_Running/Agent_OpenAI_Step01_Running.csproj +++ b/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step01_Running/Agent_OpenAI_Step01_Running.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Agent_OpenAI_Step02_Reasoning.csproj b/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Agent_OpenAI_Step02_Reasoning.csproj index 4253d9cf9e..78f0981676 100644 --- a/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Agent_OpenAI_Step02_Reasoning.csproj +++ b/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Agent_OpenAI_Step02_Reasoning.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/AgentWithRAG_Step01_BasicTextRAG.csproj b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/AgentWithRAG_Step01_BasicTextRAG.csproj index 0c8a9f2dfc..860089b621 100644 --- a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/AgentWithRAG_Step01_BasicTextRAG.csproj +++ b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/AgentWithRAG_Step01_BasicTextRAG.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/TextSearchStore/TextSearchStore.cs b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/TextSearchStore/TextSearchStore.cs index 502c17dba1..82559ecf83 100644 --- a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/TextSearchStore/TextSearchStore.cs +++ b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/TextSearchStore/TextSearchStore.cs @@ -98,8 +98,8 @@ public TextSearchStore( // Create a definition so that we can use the dimensions provided at runtime. VectorStoreCollectionDefinition ragDocumentDefinition = new() { - Properties = new List() - { + Properties = + [ new VectorStoreKeyProperty("Key", this._options.KeyType ?? typeof(string)), new VectorStoreDataProperty("Namespaces", typeof(List)) { IsIndexed = true }, new VectorStoreDataProperty("SourceId", typeof(string)) { IsIndexed = true }, @@ -107,7 +107,7 @@ public TextSearchStore( new VectorStoreDataProperty("SourceName", typeof(string)), new VectorStoreDataProperty("SourceLink", typeof(string)), new VectorStoreVectorProperty("TextEmbedding", typeof(string), vectorDimensions), - } + ] }; this._vectorStoreRecordCollection = this._vectorStore.GetDynamicCollection(collectionName, ragDocumentDefinition); @@ -267,7 +267,7 @@ public async Task> SearchAsync(string query, int cancellationToken: cancellationToken); // Retrieve the documents from the search results. - List> searchResponseDocs = new(); + List> searchResponseDocs = []; await foreach (var searchResponseDoc in searchResult.WithCancellation(cancellationToken).ConfigureAwait(false)) { searchResponseDocs.Add(searchResponseDoc.Record); @@ -291,12 +291,8 @@ public async Task> SearchAsync(string query, int } // Retrieve the source text for the documents that need it. - var retrievalResponses = await this._options.SourceRetrievalCallback(sourceIdsToRetrieve).ConfigureAwait(false); - - if (retrievalResponses is null) - { + var retrievalResponses = await this._options.SourceRetrievalCallback(sourceIdsToRetrieve).ConfigureAwait(false) ?? throw new InvalidOperationException($"The {nameof(TextSearchStoreOptions.SourceRetrievalCallback)} must return a non-null value."); - } // Update the retrieved documents with the retrieved text. return searchResponseDocs.GroupJoin( diff --git a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/TextSearchStore/TextSearchStoreOptions.cs b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/TextSearchStore/TextSearchStoreOptions.cs index 53da092c82..d9b8761be6 100644 --- a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/TextSearchStore/TextSearchStoreOptions.cs +++ b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/TextSearchStore/TextSearchStoreOptions.cs @@ -107,15 +107,8 @@ public sealed class SourceRetrievalResponse /// The source text that was retrieved. public SourceRetrievalResponse(SourceRetrievalRequest request, string text) { - if (request == null) - { - throw new ArgumentNullException(nameof(request)); - } - - if (text == null) - { - throw new ArgumentNullException(nameof(text)); - } + ArgumentNullException.ThrowIfNull(request); + ArgumentNullException.ThrowIfNull(text); this.SourceId = request.SourceId; this.SourceLink = request.SourceLink; diff --git a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/AgentWithRAG_Step02_CustomVectorStoreRAG.csproj b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/AgentWithRAG_Step02_CustomVectorStoreRAG.csproj index 56e2ad232b..33029395dd 100644 --- a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/AgentWithRAG_Step02_CustomVectorStoreRAG.csproj +++ b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/AgentWithRAG_Step02_CustomVectorStoreRAG.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/README.md b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/README.md index 1817f0d8ca..131adde82b 100644 --- a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/README.md +++ b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/README.md @@ -6,7 +6,7 @@ This sample uses Qdrant for the vector store, but this can easily be swapped out ## Prerequisites -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure OpenAI service endpoint - Both a chat completion and embedding deployment configured in the Azure OpenAI resource - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/AgentWithRAG_Step03_CustomRAGDataSource.csproj b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/AgentWithRAG_Step03_CustomRAGDataSource.csproj index 8298cfe6e8..0f9de7c359 100644 --- a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/AgentWithRAG_Step03_CustomRAGDataSource.csproj +++ b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/AgentWithRAG_Step03_CustomRAGDataSource.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/Program.cs b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/Program.cs index 38bc2e09f3..e2caedbb1c 100644 --- a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/Program.cs +++ b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/Program.cs @@ -48,7 +48,7 @@ { // The mock search inspects the user's question and returns pre-defined snippets // that resemble documents stored in an external knowledge source. - List results = new(); + List results = []; if (query.Contains("return", StringComparison.OrdinalIgnoreCase) || query.Contains("refund", StringComparison.OrdinalIgnoreCase)) { diff --git a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step04_FoundryServiceRAG/AgentWithRAG_Step04_FoundryServiceRAG.csproj b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step04_FoundryServiceRAG/AgentWithRAG_Step04_FoundryServiceRAG.csproj index aefb46524f..d90e1c394b 100644 --- a/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step04_FoundryServiceRAG/AgentWithRAG_Step04_FoundryServiceRAG.csproj +++ b/dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step04_FoundryServiceRAG/AgentWithRAG_Step04_FoundryServiceRAG.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step01_Running/Agent_Step01_Running.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step01_Running/Agent_Step01_Running.csproj index 8298cfe6e8..0f9de7c359 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step01_Running/Agent_Step01_Running.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step01_Running/Agent_Step01_Running.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step02_MultiturnConversation/Agent_Step02_MultiturnConversation.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step02_MultiturnConversation/Agent_Step02_MultiturnConversation.csproj index 8298cfe6e8..0f9de7c359 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step02_MultiturnConversation/Agent_Step02_MultiturnConversation.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step02_MultiturnConversation/Agent_Step02_MultiturnConversation.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step03_UsingFunctionTools/Agent_Step03_UsingFunctionTools.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step03_UsingFunctionTools/Agent_Step03_UsingFunctionTools.csproj index 8298cfe6e8..0f9de7c359 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step03_UsingFunctionTools/Agent_Step03_UsingFunctionTools.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step03_UsingFunctionTools/Agent_Step03_UsingFunctionTools.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step04_UsingFunctionToolsWithApprovals/Agent_Step04_UsingFunctionToolsWithApprovals.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step04_UsingFunctionToolsWithApprovals/Agent_Step04_UsingFunctionToolsWithApprovals.csproj index 8298cfe6e8..0f9de7c359 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step04_UsingFunctionToolsWithApprovals/Agent_Step04_UsingFunctionToolsWithApprovals.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step04_UsingFunctionToolsWithApprovals/Agent_Step04_UsingFunctionToolsWithApprovals.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step05_StructuredOutput/Agent_Step05_StructuredOutput.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step05_StructuredOutput/Agent_Step05_StructuredOutput.csproj index 8298cfe6e8..0f9de7c359 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step05_StructuredOutput/Agent_Step05_StructuredOutput.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step05_StructuredOutput/Agent_Step05_StructuredOutput.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step06_PersistedConversations/Agent_Step06_PersistedConversations.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step06_PersistedConversations/Agent_Step06_PersistedConversations.csproj index 8298cfe6e8..0f9de7c359 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step06_PersistedConversations/Agent_Step06_PersistedConversations.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step06_PersistedConversations/Agent_Step06_PersistedConversations.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step06_PersistedConversations/Program.cs b/dotnet/samples/GettingStarted/Agents/Agent_Step06_PersistedConversations/Program.cs index 1ffe3c9993..559fc03d8c 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step06_PersistedConversations/Program.cs +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step06_PersistedConversations/Program.cs @@ -32,7 +32,7 @@ await File.WriteAllTextAsync(tempFilePath, JsonSerializer.Serialize(serializedThread)); // Load the serialized thread from the temporary file (for demonstration purposes). -JsonElement reloadedSerializedThread = JsonSerializer.Deserialize(await File.ReadAllTextAsync(tempFilePath)); +JsonElement reloadedSerializedThread = JsonElement.Parse(await File.ReadAllTextAsync(tempFilePath)); // Deserialize the thread state after loading from storage. AgentThread resumedThread = agent.DeserializeThread(reloadedSerializedThread); diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step07_3rdPartyThreadStorage/Agent_Step07_3rdPartyThreadStorage.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step07_3rdPartyThreadStorage/Agent_Step07_3rdPartyThreadStorage.csproj index 1caf270c49..860089b621 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step07_3rdPartyThreadStorage/Agent_Step07_3rdPartyThreadStorage.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step07_3rdPartyThreadStorage/Agent_Step07_3rdPartyThreadStorage.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -13,7 +13,6 @@ - diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step08_Observability/Agent_Step08_Observability.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step08_Observability/Agent_Step08_Observability.csproj index 980e282641..1a618d660a 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step08_Observability/Agent_Step08_Observability.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step08_Observability/Agent_Step08_Observability.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step09_DependencyInjection/Agent_Step09_DependencyInjection.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step09_DependencyInjection/Agent_Step09_DependencyInjection.csproj index b0890e1817..0aaa471260 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step09_DependencyInjection/Agent_Step09_DependencyInjection.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step09_DependencyInjection/Agent_Step09_DependencyInjection.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step10_AsMcpTool/Agent_Step10_AsMcpTool.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step10_AsMcpTool/Agent_Step10_AsMcpTool.csproj index 1fb367c044..d25278b3f5 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step10_AsMcpTool/Agent_Step10_AsMcpTool.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step10_AsMcpTool/Agent_Step10_AsMcpTool.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -14,7 +14,10 @@ - + + + + diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step11_UsingImages/Agent_Step11_UsingImages.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step11_UsingImages/Agent_Step11_UsingImages.csproj index 7e9e70c763..73a41005f1 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step11_UsingImages/Agent_Step11_UsingImages.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step11_UsingImages/Agent_Step11_UsingImages.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step12_AsFunctionTool/Agent_Step12_AsFunctionTool.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step12_AsFunctionTool/Agent_Step12_AsFunctionTool.csproj index 21c8d9e49e..2660090404 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step12_AsFunctionTool/Agent_Step12_AsFunctionTool.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step12_AsFunctionTool/Agent_Step12_AsFunctionTool.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step13_BackgroundResponsesWithToolsAndPersistence/Agent_Step13_BackgroundResponsesWithToolsAndPersistence.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step13_BackgroundResponsesWithToolsAndPersistence/Agent_Step13_BackgroundResponsesWithToolsAndPersistence.csproj index 4735f4a7a0..29fab5f992 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step13_BackgroundResponsesWithToolsAndPersistence/Agent_Step13_BackgroundResponsesWithToolsAndPersistence.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step13_BackgroundResponsesWithToolsAndPersistence/Agent_Step13_BackgroundResponsesWithToolsAndPersistence.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step13_BackgroundResponsesWithToolsAndPersistence/README.md b/dotnet/samples/GettingStarted/Agents/Agent_Step13_BackgroundResponsesWithToolsAndPersistence/README.md index 146f418512..ca52e8afa3 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step13_BackgroundResponsesWithToolsAndPersistence/README.md +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step13_BackgroundResponsesWithToolsAndPersistence/README.md @@ -14,7 +14,7 @@ For more information, see the [official documentation](https://learn.microsoft.c Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure OpenAI service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/Agent_Step14_Middleware.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/Agent_Step14_Middleware.csproj index 09beb78195..6582c30cd5 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/Agent_Step14_Middleware.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/Agent_Step14_Middleware.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/Program.cs b/dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/Program.cs index 28a50cc7d7..a0ca338297 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/Program.cs +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/Program.cs @@ -154,10 +154,11 @@ static IList FilterMessages(IEnumerable messages) static string FilterPii(string content) { // Regex patterns for PII detection (simplified for demonstration) - Regex[] piiPatterns = [ + Regex[] piiPatterns = + [ new(@"\b\d{3}-\d{3}-\d{4}\b", RegexOptions.Compiled), // Phone number (e.g., 123-456-7890) - new(@"\b[\w\.-]+@[\w\.-]+\.\w+\b", RegexOptions.Compiled), // Email address - new(@"\b[A-Z][a-z]+\s[A-Z][a-z]+\b", RegexOptions.Compiled) // Full name (e.g., John Doe) + new(@"\b[\w\.-]+@[\w\.-]+\.\w+\b", RegexOptions.Compiled), // Email address + new(@"\b[A-Z][a-z]+\s[A-Z][a-z]+\b", RegexOptions.Compiled) // Full name (e.g., John Doe) ]; foreach (var pattern in piiPatterns) diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step15_Plugins/Agent_Step15_Plugins.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step15_Plugins/Agent_Step15_Plugins.csproj index c1cf0bf930..ae2f9ac194 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step15_Plugins/Agent_Step15_Plugins.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step15_Plugins/Agent_Step15_Plugins.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step16_ChatReduction/Agent_Step16_ChatReduction.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step16_ChatReduction/Agent_Step16_ChatReduction.csproj index 8298cfe6e8..0f9de7c359 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step16_ChatReduction/Agent_Step16_ChatReduction.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step16_ChatReduction/Agent_Step16_ChatReduction.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/Agent_Step17_BackgroundResponses.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/Agent_Step17_BackgroundResponses.csproj index c5b2ae56a6..1c95b4af25 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/Agent_Step17_BackgroundResponses.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/Agent_Step17_BackgroundResponses.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/README.md b/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/README.md index 5b7df74ca9..e898733bc3 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/README.md +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/README.md @@ -13,7 +13,7 @@ For more information, see the [official documentation](https://learn.microsoft.c Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure OpenAI service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step18_DeepResearch/Agent_Step18_DeepResearch.csproj b/dotnet/samples/GettingStarted/Agents/Agent_Step18_DeepResearch/Agent_Step18_DeepResearch.csproj index 11c7beb3bf..d40e93232b 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step18_DeepResearch/Agent_Step18_DeepResearch.csproj +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step18_DeepResearch/Agent_Step18_DeepResearch.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Agents/README.md b/dotnet/samples/GettingStarted/Agents/README.md index f510b03faf..cbe4b65047 100644 --- a/dotnet/samples/GettingStarted/Agents/README.md +++ b/dotnet/samples/GettingStarted/Agents/README.md @@ -13,7 +13,7 @@ see the [How to create an agent for each provider](../AgentProviders/README.md) Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure OpenAI service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) - User has the `Cognitive Services OpenAI Contributor` role for the Azure OpenAI resource. diff --git a/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/DevUI_Step01_BasicUsage.csproj b/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/DevUI_Step01_BasicUsage.csproj index 8ae36b52e0..09037b5f1d 100644 --- a/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/DevUI_Step01_BasicUsage.csproj +++ b/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/DevUI_Step01_BasicUsage.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable DevUI_Step01_BasicUsage @@ -19,7 +19,6 @@ - diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.1_Basics/FoundryAgents_Step01.1_Basics.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.1_Basics/FoundryAgents_Step01.1_Basics.csproj index a2ccc2a339..89b9d8ddc0 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.1_Basics/FoundryAgents_Step01.1_Basics.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.1_Basics/FoundryAgents_Step01.1_Basics.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.1_Basics/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.1_Basics/README.md index 6a22b1df81..ce56e05755 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.1_Basics/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.1_Basics/README.md @@ -10,7 +10,7 @@ This sample demonstrates how to create and manage AI agents with Azure Foundry A Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.2_Running/FoundryAgents_Step01.2_Running.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.2_Running/FoundryAgents_Step01.2_Running.csproj index 3ed207aadf..daf7e24494 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.2_Running/FoundryAgents_Step01.2_Running.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.2_Running/FoundryAgents_Step01.2_Running.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.2_Running/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.2_Running/README.md index 26725e016e..53254e1975 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.2_Running/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.2_Running/README.md @@ -13,7 +13,7 @@ This sample demonstrates how to create and run a simple AI agent with Azure Foun Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/FoundryAgents_Step02_MultiturnConversation.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/FoundryAgents_Step02_MultiturnConversation.csproj index 3ed207aadf..daf7e24494 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/FoundryAgents_Step02_MultiturnConversation.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/FoundryAgents_Step02_MultiturnConversation.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/README.md index 2c38002f50..dab9f596db 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/README.md @@ -14,7 +14,7 @@ This sample demonstrates how to implement multi-turn conversations with AI agent Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/FoundryAgents_Step03_UsingFunctionTools.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/FoundryAgents_Step03_UsingFunctionTools.csproj index 3ed207aadf..daf7e24494 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/FoundryAgents_Step03_UsingFunctionTools.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/FoundryAgents_Step03_UsingFunctionTools.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/README.md index 934373aa80..35bef8a999 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/README.md @@ -14,7 +14,7 @@ This sample demonstrates how to use function tools with AI agents, allowing agen Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/FoundryAgents_Step04_UsingFunctionToolsWithApprovals.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/FoundryAgents_Step04_UsingFunctionToolsWithApprovals.csproj index 3ed207aadf..daf7e24494 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/FoundryAgents_Step04_UsingFunctionToolsWithApprovals.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/FoundryAgents_Step04_UsingFunctionToolsWithApprovals.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/README.md index 55aac6c8df..5a797acd0f 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/README.md @@ -14,7 +14,7 @@ This sample demonstrates how to use function tools that require human approval b Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step05_StructuredOutput/FoundryAgents_Step05_StructuredOutput.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step05_StructuredOutput/FoundryAgents_Step05_StructuredOutput.csproj index 3ed207aadf..daf7e24494 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step05_StructuredOutput/FoundryAgents_Step05_StructuredOutput.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step05_StructuredOutput/FoundryAgents_Step05_StructuredOutput.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step05_StructuredOutput/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step05_StructuredOutput/README.md index 57887fc0d3..956a2542e9 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step05_StructuredOutput/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step05_StructuredOutput/README.md @@ -14,7 +14,7 @@ This sample demonstrates how to configure AI agents to produce structured output Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/FoundryAgents_Step06_PersistedConversations.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/FoundryAgents_Step06_PersistedConversations.csproj index 3ed207aadf..daf7e24494 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/FoundryAgents_Step06_PersistedConversations.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/FoundryAgents_Step06_PersistedConversations.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/Program.cs b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/Program.cs index 305422aa4d..d404a814c0 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/Program.cs +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/Program.cs @@ -32,7 +32,7 @@ await File.WriteAllTextAsync(tempFilePath, JsonSerializer.Serialize(serializedThread)); // Load the serialized thread from the temporary file (for demonstration purposes). -JsonElement reloadedSerializedThread = JsonSerializer.Deserialize(await File.ReadAllTextAsync(tempFilePath))!; +JsonElement reloadedSerializedThread = JsonElement.Parse(await File.ReadAllTextAsync(tempFilePath))!; // Deserialize the thread state after loading from storage. AgentThread resumedThread = agent.DeserializeThread(reloadedSerializedThread); diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/README.md index f0ae590545..29c2233748 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/README.md @@ -14,7 +14,7 @@ This sample demonstrates how to serialize and persist agent conversation threads Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step07_Observability/FoundryAgents_Step07_Observability.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step07_Observability/FoundryAgents_Step07_Observability.csproj index 49b903d041..5ceeabb204 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step07_Observability/FoundryAgents_Step07_Observability.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step07_Observability/FoundryAgents_Step07_Observability.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step07_Observability/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step07_Observability/README.md index 57d4e5df13..30f7014dff 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step07_Observability/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step07_Observability/README.md @@ -15,7 +15,7 @@ This sample demonstrates how to add observability to AI agents using OpenTelemet Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) - (Optional) Application Insights connection string for Azure Monitor integration diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step08_DependencyInjection/FoundryAgents_Step08_DependencyInjection.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step08_DependencyInjection/FoundryAgents_Step08_DependencyInjection.csproj index ea8fc63de0..f1812befeb 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step08_DependencyInjection/FoundryAgents_Step08_DependencyInjection.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step08_DependencyInjection/FoundryAgents_Step08_DependencyInjection.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step08_DependencyInjection/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step08_DependencyInjection/README.md index ab2b01e5d1..580821bb0a 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step08_DependencyInjection/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step08_DependencyInjection/README.md @@ -15,7 +15,7 @@ This sample demonstrates how to use dependency injection to register and manage Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/FoundryAgents_Step09_UsingMcpClientAsTools.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/FoundryAgents_Step09_UsingMcpClientAsTools.csproj index 0ee9c80764..a6d96cb3db 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/FoundryAgents_Step09_UsingMcpClientAsTools.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/FoundryAgents_Step09_UsingMcpClientAsTools.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/README.md index 9b3322b3fb..b2d923fc2f 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/README.md @@ -14,7 +14,7 @@ This sample demonstrates how to use Model Context Protocol (MCP) client tools wi Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) - Node.js and npm installed (for running the GitHub MCP server) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step10_UsingImages/FoundryAgents_Step10_UsingImages.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step10_UsingImages/FoundryAgents_Step10_UsingImages.csproj index 1d423b22bc..53661ff199 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step10_UsingImages/FoundryAgents_Step10_UsingImages.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step10_UsingImages/FoundryAgents_Step10_UsingImages.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/FoundryAgents_Step11_AsFunctionTool.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/FoundryAgents_Step11_AsFunctionTool.csproj index f9336d4556..54f37f1aa6 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/FoundryAgents_Step11_AsFunctionTool.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/FoundryAgents_Step11_AsFunctionTool.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/README.md index 3702134ab3..4b64b7e712 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/README.md @@ -14,7 +14,7 @@ This sample demonstrates how to expose an AI agent as a function tool, enabling Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/FoundryAgents_Step12_Middleware.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/FoundryAgents_Step12_Middleware.csproj index 4de5d131d9..9f29a8d7e6 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/FoundryAgents_Step12_Middleware.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/FoundryAgents_Step12_Middleware.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/README.md index 1f7321051f..04192a2cc6 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/README.md @@ -21,7 +21,7 @@ Attempting to use function middleware on agents that do not wrap a ChatClientAge Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step13_Plugins/FoundryAgents_Step13_Plugins.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step13_Plugins/FoundryAgents_Step13_Plugins.csproj index 1c8496b239..4a34560946 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step13_Plugins/FoundryAgents_Step13_Plugins.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step13_Plugins/FoundryAgents_Step13_Plugins.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step13_Plugins/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step13_Plugins/README.md index d086e28aa0..0aeccf5789 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step13_Plugins/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step13_Plugins/README.md @@ -14,7 +14,7 @@ This sample demonstrates how to use plugins with AI agents, where plugins are se Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/FoundryAgents_Step14_CodeInterpreter.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/FoundryAgents_Step14_CodeInterpreter.csproj index 1c8496b239..4a34560946 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/FoundryAgents_Step14_CodeInterpreter.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/FoundryAgents_Step14_CodeInterpreter.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/README.md index 007f283a76..a3dd4d50b9 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/README.md @@ -15,7 +15,7 @@ This sample demonstrates how to use the code interpreter tool with AI agents. Th Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step15_ComputerUse/FoundryAgents_Step15_ComputerUse.csproj b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step15_ComputerUse/FoundryAgents_Step15_ComputerUse.csproj index 383b55a939..041c72c43e 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step15_ComputerUse/FoundryAgents_Step15_ComputerUse.csproj +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step15_ComputerUse/FoundryAgents_Step15_ComputerUse.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step15_ComputerUse/README.md b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step15_ComputerUse/README.md index 94ddf6b269..4686ec5984 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step15_ComputerUse/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step15_ComputerUse/README.md @@ -15,7 +15,7 @@ This sample demonstrates how to use the computer use tool with AI agents. The co Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/FoundryAgents/README.md b/dotnet/samples/GettingStarted/FoundryAgents/README.md index c5d027d8d7..9369f5b34e 100644 --- a/dotnet/samples/GettingStarted/FoundryAgents/README.md +++ b/dotnet/samples/GettingStarted/FoundryAgents/README.md @@ -10,7 +10,7 @@ versioning, multi-turn conversations, and advanced features like code interpreta Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and project configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server/Agent_MCP_Server.csproj b/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server/Agent_MCP_Server.csproj index c5e06bc382..aa73860c14 100644 --- a/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server/Agent_MCP_Server.csproj +++ b/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server/Agent_MCP_Server.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -13,7 +13,6 @@ - diff --git a/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server_Auth/Agent_MCP_Server_Auth.csproj b/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server_Auth/Agent_MCP_Server_Auth.csproj index 389b504c50..b3334ce8fd 100644 --- a/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server_Auth/Agent_MCP_Server_Auth.csproj +++ b/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server_Auth/Agent_MCP_Server_Auth.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -15,7 +15,10 @@ - + + + + diff --git a/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server_Auth/README.md b/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server_Auth/README.md index ae88df95ee..a6505d6524 100644 --- a/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server_Auth/README.md +++ b/dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server_Auth/README.md @@ -17,7 +17,7 @@ The sample shows: ## Installing Prerequisites - A self-signed certificate to enable HTTPS use in development, see [dotnet dev-certs](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-dev-certs) -- .NET 9.0 or later +- .NET 10.0 or later - A running TestOAuthServer (for OAuth authentication), see [Start the Test OAuth Server](https://github.com/modelcontextprotocol/csharp-sdk/tree/main/samples/ProtectedMcpClient#step-1-start-the-test-oauth-server) - A running ProtectedMCPServer (for MCP services), see [Start the Protected MCP Server](https://github.com/modelcontextprotocol/csharp-sdk/tree/main/samples/ProtectedMcpClient#step-2-start-the-protected-mcp-server) @@ -38,7 +38,7 @@ First, you need to start the TestOAuthServer which provides OAuth authentication ```bash cd \tests\ModelContextProtocol.TestOAuthServer -dotnet run --framework net9.0 +dotnet run --framework net10.0 ``` The OAuth server will start at `https://localhost:7029` diff --git a/dotnet/samples/GettingStarted/ModelContextProtocol/FoundryAgent_Hosted_MCP/FoundryAgent_Hosted_MCP.csproj b/dotnet/samples/GettingStarted/ModelContextProtocol/FoundryAgent_Hosted_MCP/FoundryAgent_Hosted_MCP.csproj index 11c7beb3bf..d40e93232b 100644 --- a/dotnet/samples/GettingStarted/ModelContextProtocol/FoundryAgent_Hosted_MCP/FoundryAgent_Hosted_MCP.csproj +++ b/dotnet/samples/GettingStarted/ModelContextProtocol/FoundryAgent_Hosted_MCP/FoundryAgent_Hosted_MCP.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/ModelContextProtocol/FoundryAgent_Hosted_MCP/README.md b/dotnet/samples/GettingStarted/ModelContextProtocol/FoundryAgent_Hosted_MCP/README.md index e320a6c3d7..f3be7da576 100644 --- a/dotnet/samples/GettingStarted/ModelContextProtocol/FoundryAgent_Hosted_MCP/README.md +++ b/dotnet/samples/GettingStarted/ModelContextProtocol/FoundryAgent_Hosted_MCP/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure Foundry service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/GettingStarted/ModelContextProtocol/README.md b/dotnet/samples/GettingStarted/ModelContextProtocol/README.md index 874afa28b8..be1aa83513 100644 --- a/dotnet/samples/GettingStarted/ModelContextProtocol/README.md +++ b/dotnet/samples/GettingStarted/ModelContextProtocol/README.md @@ -6,7 +6,7 @@ The getting started with Model Content Protocol samples demonstrate how to use M Before you begin, ensure you have the following prerequisites: -- .NET 9.0 SDK or later +- .NET 10.0 SDK or later - Azure OpenAI service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) - User has the `Cognitive Services OpenAI Contributor` role for the Azure OpenAI resource. diff --git a/dotnet/samples/GettingStarted/ModelContextProtocol/ResponseAgent_Hosted_MCP/README.md b/dotnet/samples/GettingStarted/ModelContextProtocol/ResponseAgent_Hosted_MCP/README.md index f84bd8f1b4..c311edae40 100644 --- a/dotnet/samples/GettingStarted/ModelContextProtocol/ResponseAgent_Hosted_MCP/README.md +++ b/dotnet/samples/GettingStarted/ModelContextProtocol/ResponseAgent_Hosted_MCP/README.md @@ -2,7 +2,7 @@ Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure OpenAI service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) - User has the `Cognitive Services OpenAI Contributor` role for the Azure OpenAI resource. diff --git a/dotnet/samples/GettingStarted/ModelContextProtocol/ResponseAgent_Hosted_MCP/ResponseAgent_Hosted_MCP.csproj b/dotnet/samples/GettingStarted/ModelContextProtocol/ResponseAgent_Hosted_MCP/ResponseAgent_Hosted_MCP.csproj index 0eacdab258..41aafe3437 100644 --- a/dotnet/samples/GettingStarted/ModelContextProtocol/ResponseAgent_Hosted_MCP/ResponseAgent_Hosted_MCP.csproj +++ b/dotnet/samples/GettingStarted/ModelContextProtocol/ResponseAgent_Hosted_MCP/ResponseAgent_Hosted_MCP.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Agents/CustomAgentExecutors/CustomAgentExecutors.csproj b/dotnet/samples/GettingStarted/Workflows/Agents/CustomAgentExecutors/CustomAgentExecutors.csproj index 51b18bdeb2..881f20e1af 100644 --- a/dotnet/samples/GettingStarted/Workflows/Agents/CustomAgentExecutors/CustomAgentExecutors.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Agents/CustomAgentExecutors/CustomAgentExecutors.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Agents/FoundryAgent/FoundryAgent.csproj b/dotnet/samples/GettingStarted/Workflows/Agents/FoundryAgent/FoundryAgent.csproj index 888274205a..f75c7fd28b 100644 --- a/dotnet/samples/GettingStarted/Workflows/Agents/FoundryAgent/FoundryAgent.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Agents/FoundryAgent/FoundryAgent.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Agents/WorkflowAsAnAgent/WorkflowAsAnAgent.csproj b/dotnet/samples/GettingStarted/Workflows/Agents/WorkflowAsAnAgent/WorkflowAsAnAgent.csproj index 51b18bdeb2..881f20e1af 100644 --- a/dotnet/samples/GettingStarted/Workflows/Agents/WorkflowAsAnAgent/WorkflowAsAnAgent.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Agents/WorkflowAsAnAgent/WorkflowAsAnAgent.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointAndRehydrate/CheckpointAndRehydrate.csproj b/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointAndRehydrate/CheckpointAndRehydrate.csproj index 0a0945caff..2f41070759 100644 --- a/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointAndRehydrate/CheckpointAndRehydrate.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointAndRehydrate/CheckpointAndRehydrate.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointAndResume/CheckpointAndResume.csproj b/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointAndResume/CheckpointAndResume.csproj index 0a0945caff..2f41070759 100644 --- a/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointAndResume/CheckpointAndResume.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointAndResume/CheckpointAndResume.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointWithHumanInTheLoop/CheckpointWithHumanInTheLoop.csproj b/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointWithHumanInTheLoop/CheckpointWithHumanInTheLoop.csproj index 0a0945caff..2f41070759 100644 --- a/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointWithHumanInTheLoop/CheckpointWithHumanInTheLoop.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Checkpoint/CheckpointWithHumanInTheLoop/CheckpointWithHumanInTheLoop.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Concurrent/Concurrent/Concurrent.csproj b/dotnet/samples/GettingStarted/Workflows/Concurrent/Concurrent/Concurrent.csproj index 3f3fe6d56c..28a01e4540 100644 --- a/dotnet/samples/GettingStarted/Workflows/Concurrent/Concurrent/Concurrent.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Concurrent/Concurrent/Concurrent.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Concurrent/MapReduce/MapReduce.csproj b/dotnet/samples/GettingStarted/Workflows/Concurrent/MapReduce/MapReduce.csproj index 7282e3fde4..fd311b7be3 100644 --- a/dotnet/samples/GettingStarted/Workflows/Concurrent/MapReduce/MapReduce.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Concurrent/MapReduce/MapReduce.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable diff --git a/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/01_EdgeCondition/01_EdgeCondition.csproj b/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/01_EdgeCondition/01_EdgeCondition.csproj index 17b1cb882a..495f645f83 100644 --- a/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/01_EdgeCondition/01_EdgeCondition.csproj +++ b/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/01_EdgeCondition/01_EdgeCondition.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/02_SwitchCase/02_SwitchCase.csproj b/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/02_SwitchCase/02_SwitchCase.csproj index 17b1cb882a..495f645f83 100644 --- a/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/02_SwitchCase/02_SwitchCase.csproj +++ b/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/02_SwitchCase/02_SwitchCase.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/03_MultiSelection/03_MultiSelection.csproj b/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/03_MultiSelection/03_MultiSelection.csproj index 17b1cb882a..495f645f83 100644 --- a/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/03_MultiSelection/03_MultiSelection.csproj +++ b/dotnet/samples/GettingStarted/Workflows/ConditionalEdges/03_MultiSelection/03_MultiSelection.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/ConfirmInput/ConfirmInput.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/ConfirmInput/ConfirmInput.csproj index 3254317876..da32d18b99 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/ConfirmInput/ConfirmInput.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/ConfirmInput/ConfirmInput.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/CustomerSupport/CustomerSupport.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/CustomerSupport/CustomerSupport.csproj index 5ddd570571..583dbc6e8f 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/CustomerSupport/CustomerSupport.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/CustomerSupport/CustomerSupport.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/DeepResearch/DeepResearch.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/DeepResearch/DeepResearch.csproj index 619c727b1b..413fa56210 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/DeepResearch/DeepResearch.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/DeepResearch/DeepResearch.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/ExecuteCode.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/ExecuteCode.csproj index ca7c10cde3..9725826c7a 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/ExecuteCode.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/ExecuteCode.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable 5ee045b0-aea3-4f08-8d31-32d1a6f8fed0 diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/ExecuteWorkflow.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/ExecuteWorkflow.csproj index 1fb6abe55d..074a31121d 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/ExecuteWorkflow.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/ExecuteWorkflow.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable $(NoWarn);CA1812 diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/FunctionTools/FunctionTools.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/FunctionTools/FunctionTools.csproj index 888a48f5df..f8a51cb0f2 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/FunctionTools/FunctionTools.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/FunctionTools/FunctionTools.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/GenerateCode/GenerateCode.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/GenerateCode/GenerateCode.csproj index b10f7c5e95..117e27abd8 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/GenerateCode/GenerateCode.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/GenerateCode/GenerateCode.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable 5ee045b0-aea3-4f08-8d31-32d1a6f8fed0 diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/HostedWorkflow/HostedWorkflow.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/HostedWorkflow/HostedWorkflow.csproj index 1f57e7e7bc..3cbd0ada95 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/HostedWorkflow/HostedWorkflow.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/HostedWorkflow/HostedWorkflow.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable $(NoWarn);CA1812 diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/InputArguments/InputArguments.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/InputArguments/InputArguments.csproj index 51582438eb..5ef0b7e99e 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/InputArguments/InputArguments.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/InputArguments/InputArguments.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/Marketing/Marketing.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/Marketing/Marketing.csproj index 12599a1b79..ceba7b740b 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/Marketing/Marketing.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/Marketing/Marketing.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/StudentTeacher/StudentTeacher.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/StudentTeacher/StudentTeacher.csproj index 7c210d6f96..862e39bd99 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/StudentTeacher/StudentTeacher.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/StudentTeacher/StudentTeacher.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/ToolApproval/ToolApproval.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/ToolApproval/ToolApproval.csproj index 6fa1cf12d9..1ebaa26645 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/ToolApproval/ToolApproval.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/ToolApproval/ToolApproval.csproj @@ -2,9 +2,7 @@ Exe - net9.0 - net9.0 - $(ProjectsDebugTargetFrameworks) + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/HumanInTheLoop/HumanInTheLoopBasic/HumanInTheLoopBasic.csproj b/dotnet/samples/GettingStarted/Workflows/HumanInTheLoop/HumanInTheLoopBasic/HumanInTheLoopBasic.csproj index 0a0945caff..2f41070759 100644 --- a/dotnet/samples/GettingStarted/Workflows/HumanInTheLoop/HumanInTheLoopBasic/HumanInTheLoopBasic.csproj +++ b/dotnet/samples/GettingStarted/Workflows/HumanInTheLoop/HumanInTheLoopBasic/HumanInTheLoopBasic.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Loop/Loop.csproj b/dotnet/samples/GettingStarted/Workflows/Loop/Loop.csproj index fcc2aaf5c8..0de620de0c 100644 --- a/dotnet/samples/GettingStarted/Workflows/Loop/Loop.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Loop/Loop.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Observability/ApplicationInsights/ApplicationInsights.csproj b/dotnet/samples/GettingStarted/Workflows/Observability/ApplicationInsights/ApplicationInsights.csproj index f7a5a4424f..4c91a01fad 100644 --- a/dotnet/samples/GettingStarted/Workflows/Observability/ApplicationInsights/ApplicationInsights.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Observability/ApplicationInsights/ApplicationInsights.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -11,6 +11,9 @@ + + + diff --git a/dotnet/samples/GettingStarted/Workflows/Observability/AspireDashboard/AspireDashboard.csproj b/dotnet/samples/GettingStarted/Workflows/Observability/AspireDashboard/AspireDashboard.csproj index db5479dd0f..57b34f3d69 100644 --- a/dotnet/samples/GettingStarted/Workflows/Observability/AspireDashboard/AspireDashboard.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Observability/AspireDashboard/AspireDashboard.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -12,6 +12,9 @@ + + + diff --git a/dotnet/samples/GettingStarted/Workflows/Observability/WorkflowAsAnAgent/WorkflowAsAnAgentObservability.csproj b/dotnet/samples/GettingStarted/Workflows/Observability/WorkflowAsAnAgent/WorkflowAsAnAgentObservability.csproj index 2193722d26..3e27c6b303 100644 --- a/dotnet/samples/GettingStarted/Workflows/Observability/WorkflowAsAnAgent/WorkflowAsAnAgentObservability.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Observability/WorkflowAsAnAgent/WorkflowAsAnAgentObservability.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable @@ -15,6 +15,9 @@ + + + diff --git a/dotnet/samples/GettingStarted/Workflows/SharedStates/SharedStates.csproj b/dotnet/samples/GettingStarted/Workflows/SharedStates/SharedStates.csproj index 2af5bbc1d7..35f87e7ebe 100644 --- a/dotnet/samples/GettingStarted/Workflows/SharedStates/SharedStates.csproj +++ b/dotnet/samples/GettingStarted/Workflows/SharedStates/SharedStates.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/Visualization/Visualization.csproj b/dotnet/samples/GettingStarted/Workflows/Visualization/Visualization.csproj index c9b83f7c38..57b1fef0e1 100644 --- a/dotnet/samples/GettingStarted/Workflows/Visualization/Visualization.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Visualization/Visualization.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/01_ExecutorsAndEdges/01_ExecutorsAndEdges.csproj b/dotnet/samples/GettingStarted/Workflows/_Foundational/01_ExecutorsAndEdges/01_ExecutorsAndEdges.csproj index 0a0945caff..2f41070759 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/01_ExecutorsAndEdges/01_ExecutorsAndEdges.csproj +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/01_ExecutorsAndEdges/01_ExecutorsAndEdges.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/02_Streaming/02_Streaming.csproj b/dotnet/samples/GettingStarted/Workflows/_Foundational/02_Streaming/02_Streaming.csproj index 0a0945caff..2f41070759 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/02_Streaming/02_Streaming.csproj +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/02_Streaming/02_Streaming.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/03_AgentsInWorkflows/03_AgentsInWorkflows.csproj b/dotnet/samples/GettingStarted/Workflows/_Foundational/03_AgentsInWorkflows/03_AgentsInWorkflows.csproj index 51b18bdeb2..881f20e1af 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/03_AgentsInWorkflows/03_AgentsInWorkflows.csproj +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/03_AgentsInWorkflows/03_AgentsInWorkflows.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/04_AgentWorkflowPatterns.csproj b/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/04_AgentWorkflowPatterns.csproj index 51b18bdeb2..881f20e1af 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/04_AgentWorkflowPatterns.csproj +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/04_AgentWorkflowPatterns.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/Program.cs b/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/Program.cs index 8cc66ed18a..1fa3aabb5c 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/Program.cs +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/Program.cs @@ -64,7 +64,7 @@ await RunWorkflowAsync( while (true) { Console.Write("Q: "); - messages.Add(new(ChatRole.User, Console.ReadLine()!)); + messages.Add(new(ChatRole.User, Console.ReadLine())); messages.AddRange(await RunWorkflowAsync(workflow, messages)); } diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/05_MultiModelService/05_MultiModelService.csproj b/dotnet/samples/GettingStarted/Workflows/_Foundational/05_MultiModelService/05_MultiModelService.csproj index ea370c4eaa..bc113c9f26 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/05_MultiModelService/05_MultiModelService.csproj +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/05_MultiModelService/05_MultiModelService.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/06_SubWorkflows/06_SubWorkflows.csproj b/dotnet/samples/GettingStarted/Workflows/_Foundational/06_SubWorkflows/06_SubWorkflows.csproj index 89b1e4bbe0..e3913683e1 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/06_SubWorkflows/06_SubWorkflows.csproj +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/06_SubWorkflows/06_SubWorkflows.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/07_MixedWorkflowAgentsAndExecutors/07_MixedWorkflowAgentsAndExecutors.csproj b/dotnet/samples/GettingStarted/Workflows/_Foundational/07_MixedWorkflowAgentsAndExecutors/07_MixedWorkflowAgentsAndExecutors.csproj index 51b18bdeb2..881f20e1af 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/07_MixedWorkflowAgentsAndExecutors/07_MixedWorkflowAgentsAndExecutors.csproj +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/07_MixedWorkflowAgentsAndExecutors/07_MixedWorkflowAgentsAndExecutors.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/08_WriterCriticWorkflow/08_WriterCriticWorkflow.csproj b/dotnet/samples/GettingStarted/Workflows/_Foundational/08_WriterCriticWorkflow/08_WriterCriticWorkflow.csproj index 24901257c8..e7a65f11a7 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/08_WriterCriticWorkflow/08_WriterCriticWorkflow.csproj +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/08_WriterCriticWorkflow/08_WriterCriticWorkflow.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 WriterCriticWorkflow enable enable diff --git a/dotnet/samples/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj b/dotnet/samples/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj index 2343fe016f..5a8ffecf8c 100644 --- a/dotnet/samples/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj +++ b/dotnet/samples/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/HostedAgents/AgentWithTextSearchRag/AgentWithTextSearchRag.csproj b/dotnet/samples/HostedAgents/AgentWithTextSearchRag/AgentWithTextSearchRag.csproj index 4aafb7582a..4843ab3c3b 100644 --- a/dotnet/samples/HostedAgents/AgentWithTextSearchRag/AgentWithTextSearchRag.csproj +++ b/dotnet/samples/HostedAgents/AgentWithTextSearchRag/AgentWithTextSearchRag.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/HostedAgents/AgentWithTextSearchRag/Program.cs b/dotnet/samples/HostedAgents/AgentWithTextSearchRag/Program.cs index 94552a8014..d8be12c5b5 100644 --- a/dotnet/samples/HostedAgents/AgentWithTextSearchRag/Program.cs +++ b/dotnet/samples/HostedAgents/AgentWithTextSearchRag/Program.cs @@ -38,7 +38,7 @@ { // The mock search inspects the user's question and returns pre-defined snippets // that resemble documents stored in an external knowledge source. - List results = new(); + List results = []; if (query.Contains("return", StringComparison.OrdinalIgnoreCase) || query.Contains("refund", StringComparison.OrdinalIgnoreCase)) { diff --git a/dotnet/samples/HostedAgents/AgentsInWorkflows/AgentsInWorkflows.csproj b/dotnet/samples/HostedAgents/AgentsInWorkflows/AgentsInWorkflows.csproj index 7e70caabda..e9dd730ecc 100644 --- a/dotnet/samples/HostedAgents/AgentsInWorkflows/AgentsInWorkflows.csproj +++ b/dotnet/samples/HostedAgents/AgentsInWorkflows/AgentsInWorkflows.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/samples/HostedAgents/AgentsInWorkflows/README.md b/dotnet/samples/HostedAgents/AgentsInWorkflows/README.md index a92012157e..5f6babc755 100644 --- a/dotnet/samples/HostedAgents/AgentsInWorkflows/README.md +++ b/dotnet/samples/HostedAgents/AgentsInWorkflows/README.md @@ -13,7 +13,7 @@ The agents are connected sequentially, creating a translation chain that demonst Before you begin, ensure you have the following prerequisites: -- .NET 8.0 SDK or later +- .NET 10 SDK or later - Azure OpenAI service endpoint and deployment configured - Azure CLI installed and authenticated (for Azure credential authentication) diff --git a/dotnet/samples/M365Agent/M365Agent.csproj b/dotnet/samples/M365Agent/M365Agent.csproj index 9beff68dc7..f40d404204 100644 --- a/dotnet/samples/M365Agent/M365Agent.csproj +++ b/dotnet/samples/M365Agent/M365Agent.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable b842df34-390f-490d-9dc0-73909363ad16 @@ -20,7 +20,6 @@ - diff --git a/dotnet/samples/M365Agent/README.md b/dotnet/samples/M365Agent/README.md index e669474ef9..e61fa438f5 100644 --- a/dotnet/samples/M365Agent/README.md +++ b/dotnet/samples/M365Agent/README.md @@ -8,7 +8,7 @@ This Agent Sample is intended to introduce you the basics of integrating Agent F ## Prerequisites -- [.NET 8.0 SDK or later](https://dotnet.microsoft.com/download) +- [.NET 10.0 SDK or later](https://dotnet.microsoft.com/download) - [devtunnel](https://learn.microsoft.com/azure/developer/dev-tunnels/get-started?tabs=windows) - [Microsoft 365 Agents Toolkit](https://github.com/OfficeDev/microsoft-365-agents-toolkit) diff --git a/dotnet/samples/Purview/AgentWithPurview/AgentWithPurview.csproj b/dotnet/samples/Purview/AgentWithPurview/AgentWithPurview.csproj index 8dc509efed..0a79857d64 100644 --- a/dotnet/samples/Purview/AgentWithPurview/AgentWithPurview.csproj +++ b/dotnet/samples/Purview/AgentWithPurview/AgentWithPurview.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/dotnet/src/Microsoft.Agents.AI.A2A/Microsoft.Agents.AI.A2A.csproj b/dotnet/src/Microsoft.Agents.AI.A2A/Microsoft.Agents.AI.A2A.csproj index 46e3c97d8f..3346066bd6 100644 --- a/dotnet/src/Microsoft.Agents.AI.A2A/Microsoft.Agents.AI.A2A.csproj +++ b/dotnet/src/Microsoft.Agents.AI.A2A/Microsoft.Agents.AI.A2A.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview @@ -14,8 +12,8 @@ - - + + diff --git a/dotnet/src/Microsoft.Agents.AI.AGUI/AGUIChatClient.cs b/dotnet/src/Microsoft.Agents.AI.AGUI/AGUIChatClient.cs index a168e2eab6..3571d97085 100644 --- a/dotnet/src/Microsoft.Agents.AI.AGUI/AGUIChatClient.cs +++ b/dotnet/src/Microsoft.Agents.AI.AGUI/AGUIChatClient.cs @@ -82,7 +82,7 @@ public override Task GetResponseAsync(IEnumerable mes .ToChatResponseAsync(cancellationToken); /// - public async override IAsyncEnumerable GetStreamingResponseAsync( + public override async IAsyncEnumerable GetStreamingResponseAsync( IEnumerable messages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) diff --git a/dotnet/src/Microsoft.Agents.AI.AGUI/Microsoft.Agents.AI.AGUI.csproj b/dotnet/src/Microsoft.Agents.AI.AGUI/Microsoft.Agents.AI.AGUI.csproj index 35f89f889f..499bb60b04 100644 --- a/dotnet/src/Microsoft.Agents.AI.AGUI/Microsoft.Agents.AI.AGUI.csproj +++ b/dotnet/src/Microsoft.Agents.AI.AGUI/Microsoft.Agents.AI.AGUI.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview @@ -24,8 +22,8 @@ - - + + diff --git a/dotnet/src/Microsoft.Agents.AI.AGUI/Shared/AGUIJsonSerializerContext.cs b/dotnet/src/Microsoft.Agents.AI.AGUI/Shared/AGUIJsonSerializerContext.cs index 0b571c4ff1..b13a803625 100644 --- a/dotnet/src/Microsoft.Agents.AI.AGUI/Shared/AGUIJsonSerializerContext.cs +++ b/dotnet/src/Microsoft.Agents.AI.AGUI/Shared/AGUIJsonSerializerContext.cs @@ -59,6 +59,4 @@ namespace Microsoft.Agents.AI.AGUI; [JsonSerializable(typeof(float))] [JsonSerializable(typeof(bool))] [JsonSerializable(typeof(decimal))] -internal sealed partial class AGUIJsonSerializerContext : JsonSerializerContext -{ -} +internal sealed partial class AGUIJsonSerializerContext : JsonSerializerContext; diff --git a/dotnet/src/Microsoft.Agents.AI.AGUI/Shared/ChatResponseUpdateAGUIExtensions.cs b/dotnet/src/Microsoft.Agents.AI.AGUI/Shared/ChatResponseUpdateAGUIExtensions.cs index 46184a6588..f5fb103bd4 100644 --- a/dotnet/src/Microsoft.Agents.AI.AGUI/Shared/ChatResponseUpdateAGUIExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.AGUI/Shared/ChatResponseUpdateAGUIExtensions.cs @@ -421,7 +421,7 @@ chatResponse.Contents[0] is TextContent && // State snapshot event yield return new StateSnapshotEvent { -#if NET472 || NETSTANDARD2_0 +#if !NET Snapshot = (JsonElement?)JsonSerializer.Deserialize( dataContent.Data.ToArray(), jsonSerializerOptions.GetTypeInfo(typeof(JsonElement))) @@ -438,7 +438,7 @@ chatResponse.Contents[0] is TextContent && // but its not up to us to validate that here. yield return new StateDeltaEvent { -#if NET472 || NETSTANDARD2_0 +#if !NET Delta = (JsonElement?)JsonSerializer.Deserialize( dataContent.Data.ToArray(), jsonSerializerOptions.GetTypeInfo(typeof(JsonElement))) @@ -455,7 +455,7 @@ chatResponse.Contents[0] is TextContent && yield return new TextMessageContentEvent { MessageId = chatResponse.MessageId!, -#if NET472 || NETSTANDARD2_0 +#if !NET Delta = Encoding.UTF8.GetString(dataContent.Data.ToArray()) #else Delta = Encoding.UTF8.GetString(dataContent.Data.Span) diff --git a/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponse.cs b/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponse.cs index 2beb287918..faa1ce1743 100644 --- a/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponse.cs +++ b/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponse.cs @@ -336,7 +336,7 @@ public bool TryDeserialize(JsonSerializerOptions serializerOptions, [NotNullW private static T? DeserializeFirstTopLevelObject(string json, JsonTypeInfo typeInfo) { -#if NET9_0_OR_GREATER +#if NET // We need to deserialize only the first top-level object as a workaround for a common LLM backend // issue. GPT 3.5 Turbo commonly returns multiple top-level objects after doing a function call. // See https://community.openai.com/t/2-json-objects-returned-when-using-function-calling-and-json-mode/574348 diff --git a/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponseUpdate.cs b/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponseUpdate.cs index 954893dbcb..0e5277d453 100644 --- a/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponseUpdate.cs +++ b/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponseUpdate.cs @@ -38,9 +38,6 @@ public class AgentRunResponseUpdate /// The response update content items. private IList? _contents; - /// The name of the author of the update. - private string? _authorName; - /// Initializes a new instance of the class. [JsonConstructor] public AgentRunResponseUpdate() @@ -84,8 +81,8 @@ public AgentRunResponseUpdate(ChatResponseUpdate chatResponseUpdate) /// Gets or sets the name of the author of the response update. public string? AuthorName { - get => this._authorName; - set => this._authorName = string.IsNullOrWhiteSpace(value) ? null : value; + get => field; + set => field = string.IsNullOrWhiteSpace(value) ? null : value; } /// Gets or sets the role of the author of the response update. diff --git a/dotnet/src/Microsoft.Agents.AI.Abstractions/Microsoft.Agents.AI.Abstractions.csproj b/dotnet/src/Microsoft.Agents.AI.Abstractions/Microsoft.Agents.AI.Abstractions.csproj index 4add7f427c..6b6f9d44f2 100644 --- a/dotnet/src/Microsoft.Agents.AI.Abstractions/Microsoft.Agents.AI.Abstractions.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Abstractions/Microsoft.Agents.AI.Abstractions.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) Microsoft.Agents.AI $(NoWarn);MEAI001 preview diff --git a/dotnet/src/Microsoft.Agents.AI.AzureAI.Persistent/Microsoft.Agents.AI.AzureAI.Persistent.csproj b/dotnet/src/Microsoft.Agents.AI.AzureAI.Persistent/Microsoft.Agents.AI.AzureAI.Persistent.csproj index bdf668391b..31785a8fa9 100644 --- a/dotnet/src/Microsoft.Agents.AI.AzureAI.Persistent/Microsoft.Agents.AI.AzureAI.Persistent.csproj +++ b/dotnet/src/Microsoft.Agents.AI.AzureAI.Persistent/Microsoft.Agents.AI.AzureAI.Persistent.csproj @@ -1,8 +1,6 @@  - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview enable diff --git a/dotnet/src/Microsoft.Agents.AI.AzureAI.Persistent/PersistentAgentsClientExtensions.cs b/dotnet/src/Microsoft.Agents.AI.AzureAI.Persistent/PersistentAgentsClientExtensions.cs index 1d5f228fcc..ddb1ee7840 100644 --- a/dotnet/src/Microsoft.Agents.AI.AzureAI.Persistent/PersistentAgentsClientExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.AzureAI.Persistent/PersistentAgentsClientExtensions.cs @@ -506,7 +506,7 @@ private static (List? ToolDefinitions, ToolResources? ToolResour { case HostedCodeInterpreterTool codeTool: - toolDefinitions ??= new(); + toolDefinitions ??= []; toolDefinitions.Add(new CodeInterpreterToolDefinition()); if (codeTool.Inputs is { Count: > 0 }) @@ -527,7 +527,7 @@ private static (List? ToolDefinitions, ToolResources? ToolResour break; case HostedFileSearchTool fileSearchTool: - toolDefinitions ??= new(); + toolDefinitions ??= []; toolDefinitions.Add(new FileSearchToolDefinition { FileSearch = new() { MaxNumResults = fileSearchTool.MaximumResultCount } @@ -550,12 +550,12 @@ private static (List? ToolDefinitions, ToolResources? ToolResour break; case HostedWebSearchTool webSearch when webSearch.AdditionalProperties?.TryGetValue("connectionId", out object? connectionId) is true: - toolDefinitions ??= new(); + toolDefinitions ??= []; toolDefinitions.Add(new BingGroundingToolDefinition(new BingGroundingSearchToolParameters([new BingGroundingSearchConfiguration(connectionId!.ToString())]))); break; default: - functionToolsAndOtherTools ??= new(); + functionToolsAndOtherTools ??= []; functionToolsAndOtherTools.Add(tool); break; } diff --git a/dotnet/src/Microsoft.Agents.AI.AzureAI/AzureAIProjectChatClient.cs b/dotnet/src/Microsoft.Agents.AI.AzureAI/AzureAIProjectChatClient.cs index 2a5ace7a0a..8acafc8fc3 100644 --- a/dotnet/src/Microsoft.Agents.AI.AzureAI/AzureAIProjectChatClient.cs +++ b/dotnet/src/Microsoft.Agents.AI.AzureAI/AzureAIProjectChatClient.cs @@ -101,7 +101,7 @@ public override async Task GetResponseAsync(IEnumerable - public async override IAsyncEnumerable GetStreamingResponseAsync(IEnumerable messages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) + public override async IAsyncEnumerable GetStreamingResponseAsync(IEnumerable messages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) { var agentOptions = this.GetAgentEnabledChatOptions(options); diff --git a/dotnet/src/Microsoft.Agents.AI.AzureAI/Microsoft.Agents.AI.AzureAI.csproj b/dotnet/src/Microsoft.Agents.AI.AzureAI/Microsoft.Agents.AI.AzureAI.csproj index ff9a1c38fa..233718b3e4 100644 --- a/dotnet/src/Microsoft.Agents.AI.AzureAI/Microsoft.Agents.AI.AzureAI.csproj +++ b/dotnet/src/Microsoft.Agents.AI.AzureAI/Microsoft.Agents.AI.AzureAI.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview enable true diff --git a/dotnet/src/Microsoft.Agents.AI.CopilotStudio/Microsoft.Agents.AI.CopilotStudio.csproj b/dotnet/src/Microsoft.Agents.AI.CopilotStudio/Microsoft.Agents.AI.CopilotStudio.csproj index d5aad73169..daa2757385 100644 --- a/dotnet/src/Microsoft.Agents.AI.CopilotStudio/Microsoft.Agents.AI.CopilotStudio.csproj +++ b/dotnet/src/Microsoft.Agents.AI.CopilotStudio/Microsoft.Agents.AI.CopilotStudio.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview diff --git a/dotnet/src/Microsoft.Agents.AI.DevUI/Entities/MetaResponse.cs b/dotnet/src/Microsoft.Agents.AI.DevUI/Entities/MetaResponse.cs index 6e1260cdc7..df717c6952 100644 --- a/dotnet/src/Microsoft.Agents.AI.DevUI/Entities/MetaResponse.cs +++ b/dotnet/src/Microsoft.Agents.AI.DevUI/Entities/MetaResponse.cs @@ -55,7 +55,7 @@ internal sealed record MetaResponse /// - "openai_proxy": Whether the server can proxy requests to OpenAI /// [JsonPropertyName("capabilities")] - public Dictionary Capabilities { get; init; } = new(); + public Dictionary Capabilities { get; init; } = []; /// /// Gets a value indicating whether Bearer token authentication is required for API access. diff --git a/dotnet/src/Microsoft.Agents.AI.DevUI/Microsoft.Agents.AI.DevUI.csproj b/dotnet/src/Microsoft.Agents.AI.DevUI/Microsoft.Agents.AI.DevUI.csproj index 6c9c5bd9e3..30943cb5c4 100644 --- a/dotnet/src/Microsoft.Agents.AI.DevUI/Microsoft.Agents.AI.DevUI.csproj +++ b/dotnet/src/Microsoft.Agents.AI.DevUI/Microsoft.Agents.AI.DevUI.csproj @@ -1,8 +1,7 @@  - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) enable enable Microsoft.Agents.AI.DevUI @@ -28,10 +27,6 @@ - - - - Microsoft Agent Framework Developer UI diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/Microsoft.Agents.AI.DurableTask.csproj b/dotnet/src/Microsoft.Agents.AI.DurableTask/Microsoft.Agents.AI.DurableTask.csproj index 85f790d17b..036b5ab5bb 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/Microsoft.Agents.AI.DurableTask.csproj +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/Microsoft.Agents.AI.DurableTask.csproj @@ -1,8 +1,7 @@  - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) enable diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/State/DurableAgentStateJsonContext.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/State/DurableAgentStateJsonContext.cs index 2684fcd3e1..4ad9a62835 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/State/DurableAgentStateJsonContext.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/State/DurableAgentStateJsonContext.cs @@ -37,6 +37,4 @@ namespace Microsoft.Agents.AI.DurableTask.State; [JsonSerializable(typeof(TimeSpan))] [JsonSerializable(typeof(DateTime))] [JsonSerializable(typeof(DateTimeOffset))] -internal sealed partial class DurableAgentStateJsonContext : JsonSerializerContext -{ -} +internal sealed partial class DurableAgentStateJsonContext : JsonSerializerContext; diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.A2A.AspNetCore/Microsoft.Agents.AI.Hosting.A2A.AspNetCore.csproj b/dotnet/src/Microsoft.Agents.AI.Hosting.A2A.AspNetCore/Microsoft.Agents.AI.Hosting.A2A.AspNetCore.csproj index c23796ad56..4266e4a8ca 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.A2A.AspNetCore/Microsoft.Agents.AI.Hosting.A2A.AspNetCore.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.A2A.AspNetCore/Microsoft.Agents.AI.Hosting.A2A.AspNetCore.csproj @@ -1,8 +1,7 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) Microsoft.Agents.AI.Hosting.A2A.AspNetCore preview @@ -11,11 +10,14 @@ - - - + + + + + + diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.A2A/Microsoft.Agents.AI.Hosting.A2A.csproj b/dotnet/src/Microsoft.Agents.AI.Hosting.A2A/Microsoft.Agents.AI.Hosting.A2A.csproj index f300483f63..b19fc5bd12 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.A2A/Microsoft.Agents.AI.Hosting.A2A.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.A2A/Microsoft.Agents.AI.Hosting.A2A.csproj @@ -1,8 +1,7 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) Microsoft.Agents.AI.Hosting.A2A preview Microsoft Agent Framework Hosting A2A @@ -17,9 +16,10 @@ + - - + + diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.csproj b/dotnet/src/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.csproj index 869b931a20..102b0fe91c 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.csproj @@ -1,8 +1,7 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) Microsoft.Agents.AI.Hosting.AGUI.AspNetCore preview $(DefineConstants);ASPNETCORE @@ -24,8 +23,10 @@ - - + + + + diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs index 291f042db5..10b1bc54ff 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs @@ -22,11 +22,8 @@ public async ValueTask ExecuteAsync(FunctionContext context) ArgumentNullException.ThrowIfNull(context); // Acquire the input binding feature (fail fast if missing rather than null-forgiving operator). - IFunctionInputBindingFeature? functionInputBindingFeature = context.Features.Get(); - if (functionInputBindingFeature == null) - { + IFunctionInputBindingFeature? functionInputBindingFeature = context.Features.Get() ?? throw new InvalidOperationException("Function input binding feature is not available on the current context."); - } FunctionInputBindingResult? inputBindingResults = await functionInputBindingFeature.BindFunctionInputAsync(context); if (inputBindingResults is not { Values: { } values }) diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/Microsoft.Agents.AI.Hosting.AzureFunctions.csproj b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/Microsoft.Agents.AI.Hosting.AzureFunctions.csproj index bb9ccc6ca0..ce67c9621e 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/Microsoft.Agents.AI.Hosting.AzureFunctions.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/Microsoft.Agents.AI.Hosting.AzureFunctions.csproj @@ -1,8 +1,7 @@  - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) enable $(NoWarn);CA2007 diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/ChatCompletions/Converters/ChatClientAgentRunOptionsConverter.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/ChatCompletions/Converters/ChatClientAgentRunOptionsConverter.cs index 5f50251f74..3158d87848 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/ChatCompletions/Converters/ChatClientAgentRunOptionsConverter.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/ChatCompletions/Converters/ChatClientAgentRunOptionsConverter.cs @@ -10,7 +10,7 @@ namespace Microsoft.Agents.AI.Hosting.OpenAI.ChatCompletions.Converters; internal static class ChatClientAgentRunOptionsConverter { - private static readonly JsonElement s_emptyJson = JsonDocument.Parse("{}").RootElement; + private static readonly JsonElement s_emptyJson = JsonElement.Parse("{}"); public static ChatClientAgentRunOptions BuildOptions(this CreateChatCompletion request) { diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Conversations/InMemoryConversationStorage.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Conversations/InMemoryConversationStorage.cs index 11b9dd9f0a..d537f33eb9 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Conversations/InMemoryConversationStorage.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Conversations/InMemoryConversationStorage.cs @@ -210,11 +210,10 @@ private sealed class ConversationState #if NET9_0_OR_GREATER private readonly OrderedDictionary _items = []; private readonly object _lock = new(); - private Conversation _conversation; public ConversationState(Conversation conversation) { - this._conversation = conversation; + this.Conversation = conversation; } public Conversation Conversation @@ -223,16 +222,18 @@ public Conversation Conversation { lock (this._lock) { - return this._conversation; + return field; } } + + private set; } public void UpdateConversation(Conversation conversation) { lock (this._lock) { - this._conversation = conversation; + this.Conversation = conversation; } } @@ -274,11 +275,10 @@ public bool RemoveItem(string itemId) #else private readonly List _items = []; private readonly object _lock = new(); - private Conversation _conversation; public ConversationState(Conversation conversation) { - this._conversation = conversation; + this.Conversation = conversation; } public Conversation Conversation @@ -287,16 +287,18 @@ public Conversation Conversation { lock (this._lock) { - return this._conversation; + return field; } } + + private set; } public void UpdateConversation(Conversation conversation) { lock (this._lock) { - this._conversation = conversation; + this.Conversation = conversation; } } diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Microsoft.Agents.AI.Hosting.OpenAI.csproj b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Microsoft.Agents.AI.Hosting.OpenAI.csproj index 707cc4fe68..7dba4e3568 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Microsoft.Agents.AI.Hosting.OpenAI.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Microsoft.Agents.AI.Hosting.OpenAI.csproj @@ -1,8 +1,7 @@  - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) $(NoWarn);OPENAI001;MEAI001 Microsoft.Agents.AI.Hosting.OpenAI alpha @@ -22,12 +21,15 @@ - + + + - + + - + diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Converters/ItemContentConverter.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Converters/ItemContentConverter.cs index 32262d2e2c..2476ce2fbd 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Converters/ItemContentConverter.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Converters/ItemContentConverter.cs @@ -140,10 +140,7 @@ DataContent audioData when audioData.HasTopLevelMediaType("audio") => _ => null }; - if (result is not null) - { - result.RawRepresentation = content; - } + result?.RawRepresentation = content; return result; } diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Models/InputMessage.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Models/InputMessage.cs index 029be0752a..c1ede61188 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Models/InputMessage.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Models/InputMessage.cs @@ -40,7 +40,7 @@ public ChatMessage ToChatMessage() { if (this.Content.IsText) { - return new ChatMessage(this.Role, this.Content.Text!); + return new ChatMessage(this.Role, this.Content.Text); } else if (this.Content.IsContents) { diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting/HostedAgentBuilderExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Hosting/HostedAgentBuilderExtensions.cs index e8a55b3baa..d3a437663a 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting/HostedAgentBuilderExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting/HostedAgentBuilderExtensions.cs @@ -52,13 +52,8 @@ public static IHostedAgentBuilder WithThreadStore(this IHostedAgentBuilder build Throw.IfNull(key); var keyString = key as string; Throw.IfNullOrEmpty(keyString); - var store = createAgentThreadStore(sp, keyString); - if (store is null) - { + return createAgentThreadStore(sp, keyString) ?? throw new InvalidOperationException($"The agent thread store factory did not return a valid {nameof(AgentThreadStore)} instance for key '{keyString}'."); - } - - return store; }); return builder; } diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting/Local/LocalAgentToolRegistry.cs b/dotnet/src/Microsoft.Agents.AI.Hosting/Local/LocalAgentToolRegistry.cs index ea8d8ad74e..8c87803db3 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting/Local/LocalAgentToolRegistry.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting/Local/LocalAgentToolRegistry.cs @@ -7,7 +7,7 @@ namespace Microsoft.Agents.AI.Hosting.Local; internal sealed class LocalAgentToolRegistry { - private readonly Dictionary> _toolsByAgentName = new(); + private readonly Dictionary> _toolsByAgentName = []; public void AddTool(string agentName, AITool tool) { diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting/Microsoft.Agents.AI.Hosting.csproj b/dotnet/src/Microsoft.Agents.AI.Hosting/Microsoft.Agents.AI.Hosting.csproj index 86f709877d..70c690bfdf 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting/Microsoft.Agents.AI.Hosting.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Hosting/Microsoft.Agents.AI.Hosting.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview diff --git a/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Client.cs b/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Client.cs index ad8120c402..c3be7c6262 100644 --- a/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Client.cs +++ b/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Client.cs @@ -71,7 +71,7 @@ public async Task> SearchAsync(string? applicationId, string var response = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); #endif var searchResponseItems = JsonSerializer.Deserialize(response, Mem0SourceGenerationContext.Default.SearchResponseItemArray); - return searchResponseItems?.Select(item => item.Memory) ?? Array.Empty(); + return searchResponseItems?.Select(item => item.Memory) ?? []; } /// @@ -94,14 +94,14 @@ public async Task CreateMemoryAsync(string? applicationId, string? agentId, stri AgentId = agentId, RunId = threadId, UserId = userId, - Messages = new[] - { + Messages = + [ new CreateMemoryMessage { Content = messageContent, Role = messageRole.ToLowerInvariant() } - } + ] }; #pragma warning restore CA1308 diff --git a/dotnet/src/Microsoft.Agents.AI.Mem0/Microsoft.Agents.AI.Mem0.csproj b/dotnet/src/Microsoft.Agents.AI.Mem0/Microsoft.Agents.AI.Mem0.csproj index e78e93c955..19a5019843 100644 --- a/dotnet/src/Microsoft.Agents.AI.Mem0/Microsoft.Agents.AI.Mem0.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Mem0/Microsoft.Agents.AI.Mem0.csproj @@ -1,8 +1,6 @@  - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview diff --git a/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs b/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs index 71f9b5436b..07cb47da81 100644 --- a/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs @@ -500,7 +500,7 @@ private static (List? ToolDefinitions, ToolResources? ToolResour { case HostedCodeInterpreterTool codeTool: - toolDefinitions ??= new(); + toolDefinitions ??= []; toolDefinitions.Add(new CodeInterpreterToolDefinition()); if (codeTool.Inputs is { Count: > 0 }) @@ -521,7 +521,7 @@ private static (List? ToolDefinitions, ToolResources? ToolResour break; case HostedFileSearchTool fileSearchTool: - toolDefinitions ??= new(); + toolDefinitions ??= []; toolDefinitions.Add(new FileSearchToolDefinition { MaxResults = fileSearchTool.MaximumResultCount, @@ -544,7 +544,7 @@ private static (List? ToolDefinitions, ToolResources? ToolResour break; default: - functionToolsAndOtherTools ??= new(); + functionToolsAndOtherTools ??= []; functionToolsAndOtherTools.Add(tool); break; } diff --git a/dotnet/src/Microsoft.Agents.AI.OpenAI/Microsoft.Agents.AI.OpenAI.csproj b/dotnet/src/Microsoft.Agents.AI.OpenAI/Microsoft.Agents.AI.OpenAI.csproj index 3c79bb3071..bfcf6e5263 100644 --- a/dotnet/src/Microsoft.Agents.AI.OpenAI/Microsoft.Agents.AI.OpenAI.csproj +++ b/dotnet/src/Microsoft.Agents.AI.OpenAI/Microsoft.Agents.AI.OpenAI.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview $(NoWarn);OPENAI001; enable diff --git a/dotnet/src/Microsoft.Agents.AI.Purview/BackgroundJobRunner.cs b/dotnet/src/Microsoft.Agents.AI.Purview/BackgroundJobRunner.cs index d55c5a6a66..5469079015 100644 --- a/dotnet/src/Microsoft.Agents.AI.Purview/BackgroundJobRunner.cs +++ b/dotnet/src/Microsoft.Agents.AI.Purview/BackgroundJobRunner.cs @@ -41,9 +41,7 @@ public BackgroundJobRunner(IChannelHandler channelHandler, IPurviewClient purvie { await this.RunJobAsync(job).ConfigureAwait(false); } - catch (Exception e) when ( - !(e is OperationCanceledException) && - !(e is SystemException)) + catch (Exception e) when (e is not OperationCanceledException and not SystemException) { this._logger.LogError(e, "Error running background job {BackgroundJobError}.", e.Message); } diff --git a/dotnet/src/Microsoft.Agents.AI.Purview/ChannelHandler.cs b/dotnet/src/Microsoft.Agents.AI.Purview/ChannelHandler.cs index ed3111fb3f..746014b700 100644 --- a/dotnet/src/Microsoft.Agents.AI.Purview/ChannelHandler.cs +++ b/dotnet/src/Microsoft.Agents.AI.Purview/ChannelHandler.cs @@ -71,16 +71,9 @@ public void QueueJob(BackgroundJobBase job) } } } - catch (Exception e) + catch (Exception e) when (this._purviewSettings.IgnoreExceptions) { - if (this._purviewSettings.IgnoreExceptions) - { - this._logger.LogError(e, "Error queuing job: {ExceptionMessage}", e.Message); - } - else - { - throw; - } + this._logger.LogError(e, "Error queuing job: {ExceptionMessage}", e.Message); } } diff --git a/dotnet/src/Microsoft.Agents.AI.Purview/Microsoft.Agents.AI.Purview.csproj b/dotnet/src/Microsoft.Agents.AI.Purview/Microsoft.Agents.AI.Purview.csproj index 20eca86359..75c19ad7c9 100644 --- a/dotnet/src/Microsoft.Agents.AI.Purview/Microsoft.Agents.AI.Purview.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Purview/Microsoft.Agents.AI.Purview.csproj @@ -1,8 +1,6 @@  - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) alpha diff --git a/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ContentBase.cs b/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ContentBase.cs index 9619d27fc8..6a2a92226d 100644 --- a/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ContentBase.cs +++ b/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ContentBase.cs @@ -15,7 +15,7 @@ internal abstract class ContentBase : GraphDataTypeBase /// Creates a new instance of the class. /// /// The graph data type of the content. - public ContentBase(string dataType) : base(dataType) + protected ContentBase(string dataType) : base(dataType) { } } diff --git a/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/GraphDataTypeBase.cs b/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/GraphDataTypeBase.cs index b4334fdb43..df54240662 100644 --- a/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/GraphDataTypeBase.cs +++ b/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/GraphDataTypeBase.cs @@ -13,7 +13,7 @@ internal abstract class GraphDataTypeBase /// Create a new instance of the class. /// /// The data type of the graph object. - public GraphDataTypeBase(string dataType) + protected GraphDataTypeBase(string dataType) { this.DataType = dataType; } diff --git a/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ProcessContentMetadataBase.cs b/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ProcessContentMetadataBase.cs index 51f4936e82..a401288127 100644 --- a/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ProcessContentMetadataBase.cs +++ b/dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ProcessContentMetadataBase.cs @@ -21,7 +21,7 @@ internal abstract class ProcessContentMetadataBase : GraphDataTypeBase /// The unique identifier for the content. /// Indicates if the content is truncated. /// The name of the content. - public ProcessContentMetadataBase(ContentBase content, string identifier, bool isTruncated, string name) : base(ProcessConversationMetadataDataType) + protected ProcessContentMetadataBase(ContentBase content, string identifier, bool isTruncated, string name) : base(ProcessConversationMetadataDataType) { this.Identifier = identifier; this.IsTruncated = isTruncated; diff --git a/dotnet/src/Microsoft.Agents.AI.Purview/Models/Jobs/BackgroundJobBase.cs b/dotnet/src/Microsoft.Agents.AI.Purview/Models/Jobs/BackgroundJobBase.cs index ab8cc8a588..d3c9317628 100644 --- a/dotnet/src/Microsoft.Agents.AI.Purview/Models/Jobs/BackgroundJobBase.cs +++ b/dotnet/src/Microsoft.Agents.AI.Purview/Models/Jobs/BackgroundJobBase.cs @@ -5,6 +5,4 @@ namespace Microsoft.Agents.AI.Purview.Models.Jobs; /// /// Abstract base class for background jobs. /// -internal abstract class BackgroundJobBase -{ -} +internal abstract class BackgroundJobBase; diff --git a/dotnet/src/Microsoft.Agents.AI.Purview/PurviewExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Purview/PurviewExtensions.cs index cdeb395d67..4095345d99 100644 --- a/dotnet/src/Microsoft.Agents.AI.Purview/PurviewExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Purview/PurviewExtensions.cs @@ -112,11 +112,7 @@ public static Func PurviewAgentMiddleware(TokenCredential toke /// The id of the owner of the message. public static void SetUserId(this ChatMessage message, Guid userId) { - if (message.AdditionalProperties == null) - { - message.AdditionalProperties = new AdditionalPropertiesDictionary(); - } - + message.AdditionalProperties ??= []; message.AdditionalProperties[Constants.UserId] = userId.ToString(); } } diff --git a/dotnet/src/Microsoft.Agents.AI.Purview/ScopedContentProcessor.cs b/dotnet/src/Microsoft.Agents.AI.Purview/ScopedContentProcessor.cs index da9e61a22e..d094ec2c31 100644 --- a/dotnet/src/Microsoft.Agents.AI.Purview/ScopedContentProcessor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Purview/ScopedContentProcessor.cs @@ -101,7 +101,7 @@ private static bool TryGetUserIdFromPayload(IEnumerable messages, o /// A list of process content requests. private async Task> MapMessageToPCRequestsAsync(IEnumerable messages, string? threadId, Activity activity, PurviewSettings settings, string? userId, CancellationToken cancellationToken) { - List pcRequests = new(); + List pcRequests = []; TokenInfo? tokenInfo = null; bool needUserId = userId == null && TryGetUserIdFromPayload(messages, out userId); @@ -162,7 +162,7 @@ private async Task> MapMessageToPCRequestsAsync(IEnu OperatingSystemVersion = "Unknown" } }; - ContentToProcess contentToProcess = new(new List { conversationmetadata }, activityMetadata, deviceMetadata, integratedAppMetadata, protectedAppMetadata); + ContentToProcess contentToProcess = new([conversationmetadata], activityMetadata, deviceMetadata, integratedAppMetadata, protectedAppMetadata); if (userId == null && tokenInfo?.UserId != null) @@ -279,7 +279,7 @@ private static (bool shouldProcess, List dlpActions, ExecutionMod string locationType = locationSegments.Length > 0 ? locationSegments[locationSegments.Length - 1] : pcRequest.ContentToProcess.ProtectedAppMetadata.ApplicationLocation.Value; string locationValue = pcRequest.ContentToProcess.ProtectedAppMetadata.ApplicationLocation.Value; - List dlpActions = new(); + List dlpActions = []; bool shouldProcess = false; ExecutionMode executionMode = ExecutionMode.EvaluateOffline; @@ -325,7 +325,7 @@ private static ProtectionScopesRequest CreateProtectionScopesRequest(ProcessCont return new ProtectionScopesRequest(userId, tenantId) { Activities = TranslateActivity(pcRequest.ContentToProcess.ActivityMetadata.Activity), - Locations = new List { pcRequest.ContentToProcess.ProtectedAppMetadata.ApplicationLocation }, + Locations = [pcRequest.ContentToProcess.ProtectedAppMetadata.ApplicationLocation], DeviceMetadata = pcRequest.ContentToProcess.DeviceMetadata, IntegratedAppMetadata = pcRequest.ContentToProcess.IntegratedAppMetadata, CorrelationId = correlationId diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/Microsoft.Agents.AI.Workflows.Declarative.AzureAI.csproj b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/Microsoft.Agents.AI.Workflows.Declarative.AzureAI.csproj index c43c28aaf4..1370b6fdca 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/Microsoft.Agents.AI.Workflows.Declarative.AzureAI.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/Microsoft.Agents.AI.Workflows.Declarative.AzureAI.csproj @@ -1,8 +1,6 @@  - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview $(NoWarn);MEAI001;OPENAI001 diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CodeTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CodeTemplate.cs index 87d9ab748b..af201deb4f 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CodeTemplate.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CodeTemplate.cs @@ -13,9 +13,6 @@ namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen; internal abstract class CodeTemplate { - private StringBuilder? _generationEnvironmentField; - private CompilerErrorCollection? _errorsField; - private List? _indentLengthsField; private bool _endsWithNewline; private string CurrentIndentField { get; set; } = string.Empty; @@ -146,22 +143,19 @@ public StringBuilder GenerationEnvironment { get { - return this._generationEnvironmentField ??= new StringBuilder(); - } - set - { - this._generationEnvironmentField = value; + return field ??= new StringBuilder(); } + set; } /// /// The error collection for the generation process /// - public CompilerErrorCollection Errors => this._errorsField ??= []; + public CompilerErrorCollection Errors => field ??= []; /// /// A list of the lengths of each indent that was added with PushIndent /// - private List indentLengths => this._indentLengthsField ??= []; + private List IndentLengths { get => field ??= []; } /// /// Gets the current indent we use when adding lines to the output @@ -288,7 +282,7 @@ public void PushIndent(string indent) throw new ArgumentNullException(nameof(indent)); } this.CurrentIndentField += indent; - this.indentLengths.Add(indent.Length); + this.IndentLengths.Add(indent.Length); } /// @@ -297,10 +291,10 @@ public void PushIndent(string indent) public string PopIndent() { string returnValue = string.Empty; - if (this.indentLengths.Count > 0) + if (this.IndentLengths.Count > 0) { - int indentLength = this.indentLengths[this.indentLengths.Count - 1]; - this.indentLengths.RemoveAt(this.indentLengths.Count - 1); + int indentLength = this.IndentLengths[this.IndentLengths.Count - 1]; + this.IndentLengths.RemoveAt(this.IndentLengths.Count - 1); if (indentLength > 0) { returnValue = this.CurrentIndentField.Substring(this.CurrentIndentField.Length - indentLength); @@ -315,7 +309,7 @@ public string PopIndent() /// public void ClearIndent() { - this.indentLengths.Clear(); + this.IndentLengths.Clear(); this.CurrentIndentField = string.Empty; } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ChatMessageExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ChatMessageExtensions.cs index 279fec3e6d..1aa9a6ef71 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ChatMessageExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/ChatMessageExtensions.cs @@ -20,7 +20,7 @@ public static TableValue ToTable(this IEnumerable messages) => public static IEnumerable? ToChatMessages(this DataValue? messages) { - if (messages is null || messages is BlankDataValue) + if (messages is null or BlankDataValue) { return null; } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/DataValueExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/DataValueExtensions.cs index a520593144..9d4d18db73 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/DataValueExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/DataValueExtensions.cs @@ -117,7 +117,7 @@ public static Type ToClrType(this DataType type) => public static IList? AsList(this DataValue? value) { - if (value is null || value is BlankDataValue) + if (value is null or BlankDataValue) { return null; } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeActionExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeActionExecutor.cs index 704a555159..2ad605803e 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeActionExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/DeclarativeActionExecutor.cs @@ -24,7 +24,6 @@ internal abstract class DeclarativeActionExecutor(TAction model, Workfl internal abstract class DeclarativeActionExecutor : Executor, IResettableExecutor, IModeledAction { - private string? _parentId; private readonly WorkflowFormulaState _state; protected DeclarativeActionExecutor(DialogAction model, WorkflowFormulaState state) @@ -42,7 +41,7 @@ protected DeclarativeActionExecutor(DialogAction model, WorkflowFormulaState sta public DialogAction Model { get; } - public string ParentId => this._parentId ??= this.Model.GetParentId() ?? WorkflowActionVisitor.Steps.Root(); + public string ParentId { get => field ??= this.Model.GetParentId() ?? WorkflowActionVisitor.Steps.Root(); } public RecalcEngine Engine => this._state.Engine; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj index 1f466aac4e..0b3f41ec9b 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj @@ -1,8 +1,6 @@  - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview $(NoWarn);MEAI001;OPENAI001 diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/AgentWorkflowBuilder.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/AgentWorkflowBuilder.cs index 41f0d834f0..c5272e39ea 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/AgentWorkflowBuilder.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/AgentWorkflowBuilder.cs @@ -139,7 +139,7 @@ private static Workflow BuildConcurrentCore( aggregator ??= static lists => (from list in lists where list.Count > 0 select list.Last()).ToList(); Func> endFactory = - (string _, string __) => new(new ConcurrentEndExecutor(agentExecutors.Length, aggregator)); + (_, __) => new(new ConcurrentEndExecutor(agentExecutors.Length, aggregator)); ExecutorBinding end = endFactory.BindExecutor(ConcurrentEndExecutor.ExecutorId); diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/ChatProtocolExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/ChatProtocolExecutor.cs index 56fb326338..238734b598 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/ChatProtocolExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/ChatProtocolExecutor.cs @@ -26,7 +26,7 @@ public class ChatProtocolExecutorOptions /// public abstract class ChatProtocolExecutor : StatefulExecutor> { - private readonly static Func> s_initFunction = () => []; + private static readonly Func> s_initFunction = () => []; private readonly ChatRole? _stringMessageChatRole; /// diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/AsyncRunHandleExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/AsyncRunHandleExtensions.cs index c7ac339a0c..c9936ce683 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/AsyncRunHandleExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/AsyncRunHandleExtensions.cs @@ -8,7 +8,7 @@ namespace Microsoft.Agents.AI.Workflows.Execution; internal static class AsyncRunHandleExtensions { - public async static ValueTask> WithCheckpointingAsync(this AsyncRunHandle runHandle, Func> prepareFunc) + public static async ValueTask> WithCheckpointingAsync(this AsyncRunHandle runHandle, Func> prepareFunc) { TRunType run = await prepareFunc().ConfigureAwait(false); return new Checkpointed(run, runHandle); diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/NonThrowingChannelReaderAsyncEnumerable.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/NonThrowingChannelReaderAsyncEnumerable.cs index aaae42f2f1..306373f4b7 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/NonThrowingChannelReaderAsyncEnumerable.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/NonThrowingChannelReaderAsyncEnumerable.cs @@ -16,8 +16,7 @@ internal sealed class NonThrowingChannelReaderAsyncEnumerable(ChannelReader reader, CancellationToken cancellationToken) : IAsyncEnumerator { - private T? _current; - public T Current => this._current ?? throw new InvalidOperationException("Enumeration not started."); + public T Current { get => field ?? throw new InvalidOperationException("Enumeration not started."); private set; } public ValueTask DisposeAsync() { @@ -36,7 +35,7 @@ public async ValueTask MoveNextAsync() bool hasData = await reader.WaitToReadAsync(cancellationToken).ConfigureAwait(false); if (hasData) { - this._current = await reader.ReadAsync(cancellationToken).ConfigureAwait(false); + this.Current = await reader.ReadAsync(cancellationToken).ConfigureAwait(false); return true; } } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/StateScope.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/StateScope.cs index e1c50ab1a3..93960f0f9a 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/StateScope.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Execution/StateScope.cs @@ -51,7 +51,7 @@ public bool ContainsKey(string key) Throw.IfNullOrEmpty(key); if (this._stateData.TryGetValue(key, out PortableValue? value)) { - if (typeof(T) == typeof(PortableValue) && !value.TypeId.IsMatch(typeof(PortableValue))) + if (typeof(T) == typeof(PortableValue) && !value.TypeId.IsMatch()) { // value is PortableValue, and we do not need to unwrap a PortableValue instance inside of it // Unfortunately we need to cast through object here. diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Executor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Executor.cs index e0b53429f9..647dbcd852 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Executor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Executor.cs @@ -93,18 +93,17 @@ protected virtual ISet ConfigureYieldTypes() return new HashSet(); } - private MessageRouter? _router; internal MessageRouter Router { get { - if (this._router is null) + if (field is null) { RouteBuilder routeBuilder = this.ConfigureRoutes(new RouteBuilder()); - this._router = routeBuilder.Build(); + field = routeBuilder.Build(); } - return this._router; + return field; } } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/GroupChatManager.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/GroupChatManager.cs index 9d3d55b33f..d16a4b5b43 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/GroupChatManager.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/GroupChatManager.cs @@ -13,8 +13,6 @@ namespace Microsoft.Agents.AI.Workflows; /// public abstract class GroupChatManager { - private int _maximumIterationCount = 40; - /// /// Initializes a new instance of the class. /// @@ -34,9 +32,9 @@ protected GroupChatManager() { } /// public int MaximumIterationCount { - get => this._maximumIterationCount; - set => this._maximumIterationCount = Throw.IfLessThan(value, 1); - } + get; + set => field = Throw.IfLessThan(value, 1); + } = 40; /// /// Selects the next agent to participate in the group chat based on the provided chat history and team. diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/GroupChatWorkflowBuilder.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/GroupChatWorkflowBuilder.cs index c02a609f75..12b0f9c707 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/GroupChatWorkflowBuilder.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/GroupChatWorkflowBuilder.cs @@ -53,7 +53,7 @@ public Workflow Build() Dictionary agentMap = agents.ToDictionary(a => a, a => (ExecutorBinding)new AgentRunStreamingExecutor(a, includeInputInOutput: true)); Func> groupChatHostFactory = - (string id, string runId) => new(new GroupChatHost(id, agents, agentMap, this._managerFactory)); + (id, runId) => new(new GroupChatHost(id, agents, agentMap, this._managerFactory)); ExecutorBinding host = groupChatHostFactory.BindExecutor(nameof(GroupChatHost)); WorkflowBuilder builder = new(host); diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunner.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunner.cs index 9c100ecbbf..8c7149b0be 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunner.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunner.cs @@ -225,7 +225,7 @@ private async ValueTask RunSuperstepAsync(StepContext currentStep, CancellationT // subworkflow's input queue. In order to actually process the message and align the supersteps correctly, // we need to drive the superstep of the subworkflow here. // TODO: Investigate if we can fully pull in the subworkflow execution into the WorkflowHostExecutor itself. - List subworkflowTasks = new(); + List subworkflowTasks = []; foreach (ISuperStepRunner subworkflowRunner in this.RunContext.JoinedSubworkflowRunners) { subworkflowTasks.Add(subworkflowRunner.RunSuperStepAsync(cancellationToken).AsTask()); diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Microsoft.Agents.AI.Workflows.csproj b/dotnet/src/Microsoft.Agents.AI.Workflows/Microsoft.Agents.AI.Workflows.csproj index ff2e9dee64..7379d9a6ac 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Microsoft.Agents.AI.Workflows.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Microsoft.Agents.AI.Workflows.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Reflection/RouteBuilderExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Reflection/RouteBuilderExtensions.cs index c0c6b8c8ca..f25f896db9 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Reflection/RouteBuilderExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Reflection/RouteBuilderExtensions.cs @@ -11,7 +11,7 @@ namespace Microsoft.Agents.AI.Workflows.Reflection; internal static class IMessageHandlerReflection { - private const string Nameof_HandleAsync = nameof(IMessageHandler.HandleAsync); + private const string Nameof_HandleAsync = nameof(IMessageHandler<>.HandleAsync); internal static readonly MethodInfo HandleAsync_1 = typeof(IMessageHandler<>).GetMethod(Nameof_HandleAsync, BindingFlags.Public | BindingFlags.Instance)!; internal static readonly MethodInfo HandleAsync_2 = typeof(IMessageHandler<,>).GetMethod(Nameof_HandleAsync, BindingFlags.Public | BindingFlags.Instance)!; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Reflection/ValueTaskTypeErasure.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Reflection/ValueTaskTypeErasure.cs index f8aa22b8b6..90e184c30e 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Reflection/ValueTaskTypeErasure.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Reflection/ValueTaskTypeErasure.cs @@ -9,7 +9,7 @@ namespace Microsoft.Agents.AI.Workflows.Reflection; internal static class ValueTaskReflection { - private const string Nameof_AsTask = nameof(ValueTask.AsTask); + private const string Nameof_AsTask = nameof(ValueTask<>.AsTask); internal static readonly MethodInfo AsTask = typeof(ValueTask<>).GetMethod(Nameof_AsTask, BindingFlags.Public | BindingFlags.Instance)!; internal static MethodInfo ReflectAsTask(this Type specializedType) @@ -25,7 +25,7 @@ internal static MethodInfo ReflectAsTask(this Type specializedType) internal static class TaskReflection { - private const string Nameof_Result = nameof(Task.Result); + private const string Nameof_Result = nameof(Task<>.Result); internal static readonly MethodInfo Result_get = typeof(Task<>).GetProperty(Nameof_Result)!.GetMethod!; internal static MethodInfo ReflectResult_get(this Type specializedType) diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/RequestInfoExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/RequestInfoExecutor.cs index afb07507f9..932cf297a3 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/RequestInfoExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/RequestInfoExecutor.cs @@ -10,13 +10,11 @@ namespace Microsoft.Agents.AI.Workflows.Specialized; -internal sealed class RequestPortOptions -{ -} +internal sealed class RequestPortOptions; internal sealed class RequestInfoExecutor : Executor { - private readonly Dictionary _wrappedRequests = new(); + private readonly Dictionary _wrappedRequests = []; private RequestPort Port { get; } private IExternalRequestSink? RequestSink { get; set; } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Workflow.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Workflow.cs index a4f6be1210..456838b9eb 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Workflow.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Workflow.cs @@ -120,7 +120,7 @@ internal void CheckOwnership(object? existingOwnershipSignoff = null) throw new InvalidOperationException($"Existing ownership does not match check value. {Summarize(maybeOwned)} vs. {Summarize(existingOwnershipSignoff)}"); } - string Summarize(object? maybeOwnerToken) => maybeOwnerToken switch + static string Summarize(object? maybeOwnerToken) => maybeOwnerToken switch { string s => $"'{s}'", null => "", @@ -168,11 +168,8 @@ internal void TakeOwnership(object ownerToken, bool subworkflow = false, object? Justification = "Does not exist in NetFx 4.7.2")] internal async ValueTask ReleaseOwnershipAsync(object ownerToken) { - object? originalToken = Interlocked.CompareExchange(ref this._ownerToken, null, ownerToken); - if (originalToken == null) - { + object? originalToken = Interlocked.CompareExchange(ref this._ownerToken, null, ownerToken) ?? throw new InvalidOperationException("Attempting to release ownership of a Workflow that is not owned."); - } if (!ReferenceEquals(originalToken, ownerToken)) { diff --git a/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentThread.cs b/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentThread.cs index f0f51895b2..71dc7020b6 100644 --- a/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentThread.cs +++ b/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentThread.cs @@ -17,7 +17,6 @@ namespace Microsoft.Agents.AI; [DebuggerDisplay("{DebuggerDisplay,nq}")] public class ChatClientAgentThread : AgentThread { - private string? _conversationId; private ChatMessageStore? _messageStore; /// @@ -94,10 +93,10 @@ internal ChatClientAgentThread( /// Attempted to set a conversation ID but a is already set. public string? ConversationId { - get => this._conversationId; + get; internal set { - if (string.IsNullOrWhiteSpace(this._conversationId) && string.IsNullOrWhiteSpace(value)) + if (string.IsNullOrWhiteSpace(field) && string.IsNullOrWhiteSpace(value)) { return; } @@ -110,7 +109,7 @@ internal set throw new InvalidOperationException("Only the ConversationId or MessageStore may be set, but not both and switching from one to another is not supported."); } - this._conversationId = Throw.IfNullOrWhitespace(value); + field = Throw.IfNullOrWhitespace(value); } } @@ -141,7 +140,7 @@ internal set return; } - if (!string.IsNullOrWhiteSpace(this._conversationId)) + if (!string.IsNullOrWhiteSpace(this.ConversationId)) { // If we have a conversation id already, we shouldn't switch the thread to use a message store // since it means that the thread will not work with the original agent anymore. @@ -211,7 +210,7 @@ protected override async Task MessagesReceivedAsync(IEnumerable new [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string DebuggerDisplay => - this._conversationId is { } conversationId ? $"ConversationId = {conversationId}" : + this.ConversationId is { } conversationId ? $"ConversationId = {conversationId}" : this._messageStore is InMemoryChatMessageStore inMemoryStore ? $"Count = {inMemoryStore.Count}" : this._messageStore is { } store ? $"Store = {store.GetType().Name}" : "Count = 0"; diff --git a/dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs b/dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs index 9d629df53a..c232b2d554 100644 --- a/dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs +++ b/dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs @@ -155,8 +155,8 @@ private ChatHistoryMemoryProvider( // Create a definition so that we can use the dimensions provided at runtime. var definition = new VectorStoreCollectionDefinition { - Properties = new List - { + Properties = + [ new VectorStoreKeyProperty("Key", typeof(Guid)), new VectorStoreDataProperty("Role", typeof(string)) { IsIndexed = true }, new VectorStoreDataProperty("MessageId", typeof(string)) { IsIndexed = true }, @@ -168,7 +168,7 @@ private ChatHistoryMemoryProvider( new VectorStoreDataProperty("Content", typeof(string)) { IsFullTextIndexed = true }, new VectorStoreDataProperty("CreatedAt", typeof(string)) { IsIndexed = true }, new VectorStoreVectorProperty("ContentEmbedding", typeof(string), Throw.IfLessThan(vectorDimensions, 1)) - } + ] }; this._collection = this._vectorStore.GetDynamicCollection(Throw.IfNullOrWhitespace(collectionName), definition); diff --git a/dotnet/src/Microsoft.Agents.AI/Microsoft.Agents.AI.csproj b/dotnet/src/Microsoft.Agents.AI/Microsoft.Agents.AI.csproj index e3d7f00aa1..5a9cb416c8 100644 --- a/dotnet/src/Microsoft.Agents.AI/Microsoft.Agents.AI.csproj +++ b/dotnet/src/Microsoft.Agents.AI/Microsoft.Agents.AI.csproj @@ -1,8 +1,6 @@  - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) preview $(NoWarn);MEAI001 diff --git a/dotnet/tests/AgentConformance.IntegrationTests/AgentConformance.IntegrationTests.csproj b/dotnet/tests/AgentConformance.IntegrationTests/AgentConformance.IntegrationTests.csproj index 90347f3ce8..7715845321 100644 --- a/dotnet/tests/AgentConformance.IntegrationTests/AgentConformance.IntegrationTests.csproj +++ b/dotnet/tests/AgentConformance.IntegrationTests/AgentConformance.IntegrationTests.csproj @@ -1,7 +1,6 @@ - $(ProjectsTargetFrameworks) false @@ -11,7 +10,12 @@ - + + + + + + diff --git a/dotnet/tests/AzureAI.IntegrationTests/AzureAI.IntegrationTests.csproj b/dotnet/tests/AzureAI.IntegrationTests/AzureAI.IntegrationTests.csproj index 8da1981f51..83f65051d2 100644 --- a/dotnet/tests/AzureAI.IntegrationTests/AzureAI.IntegrationTests.csproj +++ b/dotnet/tests/AzureAI.IntegrationTests/AzureAI.IntegrationTests.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) True diff --git a/dotnet/tests/AzureAIAgentsPersistent.IntegrationTests/AzureAIAgentsPersistent.IntegrationTests.csproj b/dotnet/tests/AzureAIAgentsPersistent.IntegrationTests/AzureAIAgentsPersistent.IntegrationTests.csproj index 966ea64020..4078342410 100644 --- a/dotnet/tests/AzureAIAgentsPersistent.IntegrationTests/AzureAIAgentsPersistent.IntegrationTests.csproj +++ b/dotnet/tests/AzureAIAgentsPersistent.IntegrationTests/AzureAIAgentsPersistent.IntegrationTests.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) True diff --git a/dotnet/tests/CopilotStudio.IntegrationTests/CopilotStudio.IntegrationTests.csproj b/dotnet/tests/CopilotStudio.IntegrationTests/CopilotStudio.IntegrationTests.csproj index afbcc54f01..5f535eb7bd 100644 --- a/dotnet/tests/CopilotStudio.IntegrationTests/CopilotStudio.IntegrationTests.csproj +++ b/dotnet/tests/CopilotStudio.IntegrationTests/CopilotStudio.IntegrationTests.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) True true diff --git a/dotnet/tests/Directory.Build.props b/dotnet/tests/Directory.Build.props index 6c5a318e86..e6c285595e 100644 --- a/dotnet/tests/Directory.Build.props +++ b/dotnet/tests/Directory.Build.props @@ -6,7 +6,7 @@ false true false - net472;net9.0 + net10.0;net472 b7762d10-e29b-4bb1-8b74-b6d69a667dd4 $(NoWarn);Moq1410;xUnit2023 diff --git a/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Microsoft.Agents.AI.A2A.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Microsoft.Agents.AI.A2A.UnitTests.csproj index f654f3eeec..8d4625ae41 100644 --- a/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Microsoft.Agents.AI.A2A.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/Microsoft.Agents.AI.A2A.UnitTests.csproj @@ -1,12 +1,8 @@ - - $(ProjectsTargetFrameworks) - - - - + + diff --git a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIChatClientTests.cs b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIChatClientTests.cs index 6ce89101a0..0eeacaf161 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIChatClientTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIChatClientTests.cs @@ -19,15 +19,15 @@ public sealed class AGUIAgentTests public async Task RunAsync_AggregatesStreamingUpdates_ReturnsCompleteMessagesAsync() { // Arrange - using HttpClient httpClient = this.CreateMockHttpClient(new BaseEvent[] - { + using HttpClient httpClient = this.CreateMockHttpClient( + [ new RunStartedEvent { ThreadId = "thread1", RunId = "run1" }, new TextMessageStartEvent { MessageId = "msg1", Role = AGUIRoles.Assistant }, new TextMessageContentEvent { MessageId = "msg1", Delta = "Hello" }, new TextMessageContentEvent { MessageId = "msg1", Delta = " World" }, new TextMessageEndEvent { MessageId = "msg1" }, new RunFinishedEvent { ThreadId = "thread1", RunId = "run1" } - }); + ]); var chatClient = new AGUIChatClient(httpClient, "http://localhost/agent", null, AGUIJsonSerializerContext.Default.Options); AIAgent agent = chatClient.CreateAIAgent(instructions: null, name: "agent1", description: "Test agent", tools: []); @@ -182,16 +182,16 @@ public async Task RunStreamingAsync_GeneratesUniqueRunId_ForEachInvocationAsync( { // Arrange var handler = new TestDelegatingHandler(); - handler.AddResponseWithCapture(new BaseEvent[] - { + handler.AddResponseWithCapture( + [ new RunStartedEvent { ThreadId = "thread1", RunId = "run1" }, new RunFinishedEvent { ThreadId = "thread1", RunId = "run1" } - }); - handler.AddResponseWithCapture(new BaseEvent[] - { + ]); + handler.AddResponseWithCapture( + [ new RunStartedEvent { ThreadId = "thread1", RunId = "run2" }, new RunFinishedEvent { ThreadId = "thread1", RunId = "run2" } - }); + ]); using HttpClient httpClient = new(handler); var chatClient = new AGUIChatClient(httpClient, "http://localhost/agent", null, AGUIJsonSerializerContext.Default.Options); @@ -1584,7 +1584,7 @@ public async Task GetStreamingResponseAsync_ReceivesStateSnapshot_AsDataContentW Assert.Equal("application/json", dataContent.MediaType); string jsonText = System.Text.Encoding.UTF8.GetString(dataContent.Data.ToArray()); - JsonElement deserializedState = JsonSerializer.Deserialize(jsonText); + JsonElement deserializedState = JsonElement.Parse(jsonText); Assert.Equal("abc123", deserializedState.GetProperty("sessionId").GetString()); Assert.Equal(5, deserializedState.GetProperty("step").GetInt32()); } @@ -1593,7 +1593,7 @@ public async Task GetStreamingResponseAsync_ReceivesStateSnapshot_AsDataContentW internal sealed class TestDelegatingHandler : DelegatingHandler { private readonly Queue>> _responseFactories = new(); - private readonly List _capturedRunIds = new(); + private readonly List _capturedRunIds = []; public IReadOnlyList CapturedRunIds => this._capturedRunIds; @@ -1701,7 +1701,7 @@ protected override async Task SendAsync(HttpRequestMessage this.RequestWasMade = true; // Capture the state and message count from the request -#if NET472 || NETSTANDARD2_0 +#if !NET string requestBody = await request.Content!.ReadAsStringAsync().ConfigureAwait(false); #else string requestBody = await request.Content!.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); @@ -1709,7 +1709,7 @@ protected override async Task SendAsync(HttpRequestMessage RunAgentInput? input = JsonSerializer.Deserialize(requestBody, AGUIJsonSerializerContext.Default.RunAgentInput); if (input != null) { - if (input.State.ValueKind != JsonValueKind.Undefined && input.State.ValueKind != JsonValueKind.Null) + if (input.State.ValueKind is not JsonValueKind.Undefined and not JsonValueKind.Null) { this.CapturedState = input.State; } diff --git a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIChatMessageExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIChatMessageExtensionsTests.cs index 4a8d7908e9..bc3a73fb4c 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIChatMessageExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIChatMessageExtensionsTests.cs @@ -29,9 +29,7 @@ public sealed class WeatherResponse [JsonSerializable(typeof(WeatherRequest))] [JsonSerializable(typeof(WeatherResponse))] [JsonSerializable(typeof(Dictionary))] -internal sealed partial class CustomTypesContext : JsonSerializerContext -{ -} +internal sealed partial class CustomTypesContext : JsonSerializerContext; /// /// Unit tests for the class. diff --git a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIHttpServiceTests.cs b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIHttpServiceTests.cs index ec4f34db14..b06913c837 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIHttpServiceTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIHttpServiceTests.cs @@ -22,16 +22,16 @@ public sealed class AGUIHttpServiceTests public async Task PostRunAsync_SendsRequestAndParsesSSEStream_SuccessfullyAsync() { // Arrange - BaseEvent[] events = new BaseEvent[] - { + BaseEvent[] events = + [ new RunStartedEvent { ThreadId = "thread1", RunId = "run1" }, new TextMessageStartEvent { MessageId = "msg1", Role = AGUIRoles.Assistant }, new TextMessageContentEvent { MessageId = "msg1", Delta = "Hello" }, new TextMessageEndEvent { MessageId = "msg1" }, new RunFinishedEvent { ThreadId = "thread1", RunId = "run1" } - }; + ]; - HttpClient httpClient = this.CreateMockHttpClient(events, HttpStatusCode.OK); + HttpClient httpClient = CreateMockHttpClient(events, HttpStatusCode.OK); AGUIHttpService service = new(httpClient, "http://localhost/agent"); RunAgentInput input = new() { @@ -60,7 +60,7 @@ public async Task PostRunAsync_SendsRequestAndParsesSSEStream_SuccessfullyAsync( public async Task PostRunAsync_WithNonSuccessStatusCode_ThrowsHttpRequestExceptionAsync() { // Arrange - HttpClient httpClient = this.CreateMockHttpClient([], HttpStatusCode.InternalServerError); + HttpClient httpClient = CreateMockHttpClient([], HttpStatusCode.InternalServerError); AGUIHttpService service = new(httpClient, "http://localhost/agent"); RunAgentInput input = new() { @@ -83,14 +83,14 @@ await Assert.ThrowsAsync(async () => public async Task PostRunAsync_DeserializesMultipleEventTypes_CorrectlyAsync() { // Arrange - BaseEvent[] events = new BaseEvent[] - { + BaseEvent[] events = + [ new RunStartedEvent { ThreadId = "thread1", RunId = "run1" }, new RunErrorEvent { Message = "Error occurred", Code = "ERR001" }, - new RunFinishedEvent { ThreadId = "thread1", RunId = "run1", Result = JsonDocument.Parse("\"Success\"").RootElement.Clone() } - }; + new RunFinishedEvent { ThreadId = "thread1", RunId = "run1", Result = JsonElement.Parse("\"Success\"") } + ]; - HttpClient httpClient = this.CreateMockHttpClient(events, HttpStatusCode.OK); + HttpClient httpClient = CreateMockHttpClient(events, HttpStatusCode.OK); AGUIHttpService service = new(httpClient, "http://localhost/agent"); RunAgentInput input = new() { @@ -120,7 +120,7 @@ public async Task PostRunAsync_DeserializesMultipleEventTypes_CorrectlyAsync() public async Task PostRunAsync_WithEmptyEventStream_CompletesSuccessfullyAsync() { // Arrange - HttpClient httpClient = this.CreateMockHttpClient([], HttpStatusCode.OK); + HttpClient httpClient = CreateMockHttpClient([], HttpStatusCode.OK); AGUIHttpService service = new(httpClient, "http://localhost/agent"); RunAgentInput input = new() { @@ -175,9 +175,9 @@ await Assert.ThrowsAsync(async () => }); } - private HttpClient CreateMockHttpClient(BaseEvent[] events, HttpStatusCode statusCode) + private static HttpClient CreateMockHttpClient(BaseEvent[] events, HttpStatusCode statusCode) { - string sseContent = string.Join("", events.Select(e => + string sseContent = string.Concat(events.Select(e => $"data: {JsonSerializer.Serialize(e, AGUIJsonSerializerContext.Default.BaseEvent)}\n\n")); Mock handlerMock = new(MockBehavior.Strict); diff --git a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIJsonSerializerContextTests.cs b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIJsonSerializerContextTests.cs index 566e69d992..33f259a681 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIJsonSerializerContextTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AGUIJsonSerializerContextTests.cs @@ -25,7 +25,7 @@ public void RunAgentInput_Serializes_WithAllRequiredFields() // Act string json = JsonSerializer.Serialize(input, AGUIJsonSerializerContext.Default.RunAgentInput); - JsonElement jsonElement = JsonSerializer.Deserialize(json); + JsonElement jsonElement = JsonElement.Parse(json); // Assert Assert.True(jsonElement.TryGetProperty("threadId", out JsonElement threadIdProp)); @@ -150,7 +150,7 @@ public void RunStartedEvent_Serializes_WithCorrectEventType() string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.RunStartedEvent); // Assert - var jsonElement = JsonDocument.Parse(json).RootElement; + var jsonElement = JsonElement.Parse(json); Assert.Equal(AGUIEventTypes.RunStarted, jsonElement.GetProperty("type").GetString()); } @@ -162,7 +162,7 @@ public void RunStartedEvent_Includes_ThreadIdAndRunIdInOutput() // Act string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.RunStartedEvent); - JsonElement jsonElement = JsonSerializer.Deserialize(json); + JsonElement jsonElement = JsonElement.Parse(json); // Assert Assert.True(jsonElement.TryGetProperty("threadId", out JsonElement threadIdProp)); @@ -219,7 +219,7 @@ public void RunFinishedEvent_Serializes_WithCorrectEventType() string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.RunFinishedEvent); // Assert - var jsonElement = JsonDocument.Parse(json).RootElement; + var jsonElement = JsonElement.Parse(json); Assert.Equal(AGUIEventTypes.RunFinished, jsonElement.GetProperty("type").GetString()); } @@ -227,11 +227,11 @@ public void RunFinishedEvent_Serializes_WithCorrectEventType() public void RunFinishedEvent_Includes_ThreadIdRunIdAndOptionalResult() { // Arrange - RunFinishedEvent evt = new() { ThreadId = "thread1", RunId = "run1", Result = JsonDocument.Parse("\"Success\"").RootElement.Clone() }; + RunFinishedEvent evt = new() { ThreadId = "thread1", RunId = "run1", Result = JsonElement.Parse("\"Success\"") }; // Act string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.RunFinishedEvent); - JsonElement jsonElement = JsonSerializer.Deserialize(json); + JsonElement jsonElement = JsonElement.Parse(json); // Assert Assert.True(jsonElement.TryGetProperty("threadId", out JsonElement threadIdProp)); @@ -269,7 +269,7 @@ public void RunFinishedEvent_Deserializes_FromJsonCorrectly() public void RunFinishedEvent_RoundTrip_PreservesData() { // Arrange - RunFinishedEvent original = new() { ThreadId = "thread1", RunId = "run1", Result = JsonDocument.Parse("\"Done\"").RootElement.Clone() }; + RunFinishedEvent original = new() { ThreadId = "thread1", RunId = "run1", Result = JsonElement.Parse("\"Done\"") }; // Act string json = JsonSerializer.Serialize(original, AGUIJsonSerializerContext.Default.RunFinishedEvent); @@ -292,7 +292,7 @@ public void RunErrorEvent_Serializes_WithCorrectEventType() string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.RunErrorEvent); // Assert - var jsonElement = JsonDocument.Parse(json).RootElement; + var jsonElement = JsonElement.Parse(json); Assert.Equal(AGUIEventTypes.RunError, jsonElement.GetProperty("type").GetString()); } @@ -304,7 +304,7 @@ public void RunErrorEvent_Includes_MessageAndOptionalCode() // Act string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.RunErrorEvent); - JsonElement jsonElement = JsonSerializer.Deserialize(json); + JsonElement jsonElement = JsonElement.Parse(json); // Assert Assert.True(jsonElement.TryGetProperty("message", out JsonElement messageProp)); @@ -360,7 +360,7 @@ public void TextMessageStartEvent_Serializes_WithCorrectEventType() string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.TextMessageStartEvent); // Assert - var jsonElement = JsonDocument.Parse(json).RootElement; + var jsonElement = JsonElement.Parse(json); Assert.Equal(AGUIEventTypes.TextMessageStart, jsonElement.GetProperty("type").GetString()); } @@ -372,7 +372,7 @@ public void TextMessageStartEvent_Includes_MessageIdAndRole() // Act string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.TextMessageStartEvent); - JsonElement jsonElement = JsonSerializer.Deserialize(json); + JsonElement jsonElement = JsonElement.Parse(json); // Assert Assert.True(jsonElement.TryGetProperty("messageId", out JsonElement msgIdProp)); @@ -428,7 +428,7 @@ public void TextMessageContentEvent_Serializes_WithCorrectEventType() string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.TextMessageContentEvent); // Assert - var jsonElement = JsonDocument.Parse(json).RootElement; + var jsonElement = JsonElement.Parse(json); Assert.Equal(AGUIEventTypes.TextMessageContent, jsonElement.GetProperty("type").GetString()); } @@ -440,7 +440,7 @@ public void TextMessageContentEvent_Includes_MessageIdAndDelta() // Act string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.TextMessageContentEvent); - JsonElement jsonElement = JsonSerializer.Deserialize(json); + JsonElement jsonElement = JsonElement.Parse(json); // Assert Assert.True(jsonElement.TryGetProperty("messageId", out JsonElement msgIdProp)); @@ -496,7 +496,7 @@ public void TextMessageEndEvent_Serializes_WithCorrectEventType() string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.TextMessageEndEvent); // Assert - var jsonElement = JsonDocument.Parse(json).RootElement; + var jsonElement = JsonElement.Parse(json); Assert.Equal(AGUIEventTypes.TextMessageEnd, jsonElement.GetProperty("type").GetString()); } @@ -508,7 +508,7 @@ public void TextMessageEndEvent_Includes_MessageId() // Act string json = JsonSerializer.Serialize(evt, AGUIJsonSerializerContext.Default.TextMessageEndEvent); - JsonElement jsonElement = JsonSerializer.Deserialize(json); + JsonElement jsonElement = JsonElement.Parse(json); // Assert Assert.True(jsonElement.TryGetProperty("messageId", out JsonElement msgIdProp)); @@ -557,7 +557,7 @@ public void AGUIMessage_Serializes_WithIdRoleAndContent() // Act string json = JsonSerializer.Serialize(message, AGUIJsonSerializerContext.Default.AGUIMessage); - JsonElement jsonElement = JsonSerializer.Deserialize(json); + JsonElement jsonElement = JsonElement.Parse(json); // Assert Assert.True(jsonElement.TryGetProperty("id", out JsonElement idProp)); diff --git a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AIToolExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AIToolExtensionsTests.cs index 515695a8a6..ebedd68f33 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AIToolExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/AIToolExtensionsTests.cs @@ -87,7 +87,7 @@ public void AsAGUITools_FiltersOutNonAIFunctionTools() // Arrange - mix of AIFunction and non-function tools AIFunction function = AIFunctionFactory.Create(() => "Result", "TestTool"); // Create a custom AITool that's not an AIFunction - var declaration = AIFunctionFactory.CreateDeclaration("DeclarationOnly", "Description", JsonDocument.Parse("{}").RootElement); + var declaration = AIFunctionFactory.CreateDeclaration("DeclarationOnly", "Description", JsonElement.Parse("{}")); List tools = [function, declaration]; @@ -107,7 +107,7 @@ public void AsAITools_WithAGUITool_ConvertsToAIFunctionDeclarationCorrectly() { Name = "TestTool", Description = "Test description", - Parameters = JsonDocument.Parse("{\"type\":\"object\",\"properties\":{}}").RootElement + Parameters = JsonElement.Parse("""{"type":"object","properties":{}}""") }; List aguiTools = [aguiTool]; @@ -116,7 +116,7 @@ public void AsAITools_WithAGUITool_ConvertsToAIFunctionDeclarationCorrectly() // Assert AITool tool = Assert.Single(tools); - Assert.IsAssignableFrom(tool); + Assert.IsType(tool, exactMatch: false); var declaration = (AIFunctionDeclaration)tool; Assert.Equal("TestTool", declaration.Name); Assert.Equal("Test description", declaration.Description); @@ -128,9 +128,9 @@ public void AsAITools_WithMultipleAGUITools_ConvertsAllCorrectly() // Arrange List aguiTools = [ - new AGUITool { Name = "Tool1", Description = "Desc1", Parameters = JsonDocument.Parse("{}").RootElement }, - new AGUITool { Name = "Tool2", Description = "Desc2", Parameters = JsonDocument.Parse("{}").RootElement }, - new AGUITool { Name = "Tool3", Description = "Desc3", Parameters = JsonDocument.Parse("{}").RootElement } + new AGUITool { Name = "Tool1", Description = "Desc1", Parameters = JsonElement.Parse("{}") }, + new AGUITool { Name = "Tool2", Description = "Desc2", Parameters = JsonElement.Parse("{}") }, + new AGUITool { Name = "Tool3", Description = "Desc3", Parameters = JsonElement.Parse("{}") } ]; // Act @@ -138,7 +138,7 @@ public void AsAITools_WithMultipleAGUITools_ConvertsAllCorrectly() // Assert Assert.Equal(3, tools.Count); - Assert.All(tools, t => Assert.IsAssignableFrom(t)); + Assert.All(tools, t => Assert.IsType(t, exactMatch: false)); } [Fact] @@ -176,7 +176,7 @@ public void AsAITools_CreatesDeclarationsOnly_NotInvokableFunctions() { Name = "RemoteTool", Description = "Tool implemented on server", - Parameters = JsonDocument.Parse("{\"type\":\"object\"}").RootElement + Parameters = JsonElement.Parse("""{"type":"object"}""") }; // Act @@ -185,7 +185,7 @@ public void AsAITools_CreatesDeclarationsOnly_NotInvokableFunctions() // Assert // The tool should be a declaration, not an executable function - Assert.IsAssignableFrom(tool); + Assert.IsType(tool, exactMatch: false); // AIFunctionDeclaration cannot be invoked (no implementation) // This is correct since the actual implementation exists on the client side } @@ -206,7 +206,7 @@ public void RoundTrip_AIFunctionToAGUIToolBackToDeclaration_PreservesMetadata() AITool reconstructed = aguiToolsList.AsAITools().Single(); // Assert - Assert.IsAssignableFrom(reconstructed); + Assert.IsType(reconstructed, exactMatch: false); var declaration = (AIFunctionDeclaration)reconstructed; Assert.Equal("FormatPerson", declaration.Name); Assert.Equal("Formats person information", declaration.Description); diff --git a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/ChatResponseUpdateAGUIExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/ChatResponseUpdateAGUIExtensionsTests.cs index 3f6df1eeeb..7d40cc014d 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/ChatResponseUpdateAGUIExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/ChatResponseUpdateAGUIExtensionsTests.cs @@ -400,7 +400,7 @@ public async Task AsChatResponseUpdatesAsync_ConvertsStateSnapshotEvent_ToDataCo // Verify the JSON content string jsonText = System.Text.Encoding.UTF8.GetString(dataContent.Data.ToArray()); - JsonElement deserializedState = JsonSerializer.Deserialize(jsonText); + JsonElement deserializedState = JsonElement.Parse(jsonText); Assert.Equal(42, deserializedState.GetProperty("counter").GetInt32()); Assert.Equal("active", deserializedState.GetProperty("status").GetString()); @@ -484,7 +484,7 @@ public async Task AsChatResponseUpdatesAsync_WithComplexStateSnapshot_PreservesJ ChatResponseUpdate stateUpdate = updates.First(); DataContent dataContent = Assert.IsType(stateUpdate.Contents[0]); string jsonText = System.Text.Encoding.UTF8.GetString(dataContent.Data.ToArray()); - JsonElement roundTrippedState = JsonSerializer.Deserialize(jsonText); + JsonElement roundTrippedState = JsonElement.Parse(jsonText); Assert.Equal("Alice", roundTrippedState.GetProperty("user").GetProperty("name").GetString()); Assert.Equal(30, roundTrippedState.GetProperty("user").GetProperty("age").GetInt32()); @@ -555,7 +555,7 @@ public async Task AsChatResponseUpdatesAsync_ConvertsStateDeltaEvent_ToDataConte // Verify the JSON Patch content string jsonText = System.Text.Encoding.UTF8.GetString(dataContent.Data.ToArray()); - JsonElement deserializedDelta = JsonSerializer.Deserialize(jsonText); + JsonElement deserializedDelta = JsonElement.Parse(jsonText); Assert.Equal(JsonValueKind.Array, deserializedDelta.ValueKind); Assert.Equal(2, deserializedDelta.GetArrayLength()); diff --git a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/Microsoft.Agents.AI.AGUI.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/Microsoft.Agents.AI.AGUI.UnitTests.csproj index 96eff59688..3dfb40f08f 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/Microsoft.Agents.AI.AGUI.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.AGUI.UnitTests/Microsoft.Agents.AI.AGUI.UnitTests.csproj @@ -1,12 +1,8 @@ - - $(ProjectsTargetFrameworks) - - - - + + diff --git a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AIContextProviderTests.cs b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AIContextProviderTests.cs index 0b8f41f1bb..b287c8b304 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AIContextProviderTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AIContextProviderTests.cs @@ -2,7 +2,6 @@ using System; using System.Collections.ObjectModel; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.AI; @@ -162,10 +161,5 @@ public override ValueTask InvokingAsync(InvokingContext context, Canc { return default; } - - public override JsonElement Serialize(JsonSerializerOptions? jsonSerializerOptions = null) - { - return base.Serialize(jsonSerializerOptions); - } } } diff --git a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/Microsoft.Agents.AI.Abstractions.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/Microsoft.Agents.AI.Abstractions.UnitTests.csproj index b7c5412a53..948a96cc26 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/Microsoft.Agents.AI.Abstractions.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/Microsoft.Agents.AI.Abstractions.UnitTests.csproj @@ -1,7 +1,6 @@ - $(ProjectsTargetFrameworks) $(NoWarn);MEAI001 @@ -13,9 +12,10 @@ - + + - + diff --git a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/ServiceIdAgentThreadTests.cs b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/ServiceIdAgentThreadTests.cs index e451359c23..1da79344d4 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/ServiceIdAgentThreadTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/ServiceIdAgentThreadTests.cs @@ -115,7 +115,5 @@ public TestServiceIdAgentThread(JsonElement serializedThreadState) : base(serial } // Helper class to represent empty objects - internal sealed class EmptyObject - { - } + internal sealed class EmptyObject; } diff --git a/dotnet/tests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests.csproj index 80c0086675..ca33d52d6b 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests.csproj @@ -1,9 +1,5 @@ - - $(ProjectsTargetFrameworks) - - diff --git a/dotnet/tests/Microsoft.Agents.AI.AzureAI.UnitTests/AzureAIProjectChatClientExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.AzureAI.UnitTests/AzureAIProjectChatClientExtensionsTests.cs index ede9b37919..33656a8486 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AzureAI.UnitTests/AzureAIProjectChatClientExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.AzureAI.UnitTests/AzureAIProjectChatClientExtensionsTests.cs @@ -2736,7 +2736,7 @@ public override bool TryGetValues(string name, out IEnumerable? values) { if (this._headers.TryGetValue(name, out var value)) { - values = new[] { value }; + values = [value]; return true; } diff --git a/dotnet/tests/Microsoft.Agents.AI.AzureAI.UnitTests/Microsoft.Agents.AI.AzureAI.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.AzureAI.UnitTests/Microsoft.Agents.AI.AzureAI.UnitTests.csproj index 79bc577661..193a7d47da 100644 --- a/dotnet/tests/Microsoft.Agents.AI.AzureAI.UnitTests/Microsoft.Agents.AI.AzureAI.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.AzureAI.UnitTests/Microsoft.Agents.AI.AzureAI.UnitTests.csproj @@ -1,9 +1,5 @@ - - $(ProjectsTargetFrameworks) - - diff --git a/dotnet/tests/Microsoft.Agents.AI.DevUI.UnitTests/Microsoft.Agents.AI.DevUI.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.DevUI.UnitTests/Microsoft.Agents.AI.DevUI.UnitTests.csproj index 9135a90e2e..1fc964e702 100644 --- a/dotnet/tests/Microsoft.Agents.AI.DevUI.UnitTests/Microsoft.Agents.AI.DevUI.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.DevUI.UnitTests/Microsoft.Agents.AI.DevUI.UnitTests.csproj @@ -1,15 +1,13 @@  - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) false $(NoWarn);CA1812 - - + diff --git a/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/Microsoft.Agents.AI.DurableTask.IntegrationTests.csproj b/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/Microsoft.Agents.AI.DurableTask.IntegrationTests.csproj index 7150e74bd8..db6aa6d62b 100644 --- a/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/Microsoft.Agents.AI.DurableTask.IntegrationTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/Microsoft.Agents.AI.DurableTask.IntegrationTests.csproj @@ -1,8 +1,7 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) enable b7762d10-e29b-4bb1-8b74-b6d69a667dd4 diff --git a/dotnet/tests/Microsoft.Agents.AI.DurableTask.UnitTests/Microsoft.Agents.AI.DurableTask.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.DurableTask.UnitTests/Microsoft.Agents.AI.DurableTask.UnitTests.csproj index b413733f2b..b0cf00cae1 100644 --- a/dotnet/tests/Microsoft.Agents.AI.DurableTask.UnitTests/Microsoft.Agents.AI.DurableTask.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.DurableTask.UnitTests/Microsoft.Agents.AI.DurableTask.UnitTests.csproj @@ -1,8 +1,7 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) enable b7762d10-e29b-4bb1-8b74-b6d69a667dd4 diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/Microsoft.Agents.AI.Hosting.A2A.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/Microsoft.Agents.AI.Hosting.A2A.UnitTests.csproj index 07dde4f802..42d8682870 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/Microsoft.Agents.AI.Hosting.A2A.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/Microsoft.Agents.AI.Hosting.A2A.UnitTests.csproj @@ -1,16 +1,16 @@  - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) - - + + - - + + + diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/BasicStreamingTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/BasicStreamingTests.cs index 923eaa7752..5bc4e8afad 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/BasicStreamingTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/BasicStreamingTests.cs @@ -276,18 +276,15 @@ public async ValueTask DisposeAsync() [SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Instantiated via dependency injection")] internal sealed class FakeChatClientAgent : AIAgent { - private readonly string _agentId; - private readonly string _description; - public FakeChatClientAgent() { - this._agentId = "fake-agent"; - this._description = "A fake agent for testing"; + this.Id = "fake-agent"; + this.Description = "A fake agent for testing"; } - public override string Id => this._agentId; + public override string Id { get; } - public override string? Description => this._description; + public override string? Description { get; } public override AgentThread GetNewThread() { @@ -353,18 +350,15 @@ public FakeInMemoryAgentThread(JsonElement serializedThread, JsonSerializerOptio [SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Instantiated via dependency injection")] internal sealed class FakeMultiMessageAgent : AIAgent { - private readonly string _agentId; - private readonly string _description; - public FakeMultiMessageAgent() { - this._agentId = "fake-multi-message-agent"; - this._description = "A fake agent that sends multiple messages for testing"; + this.Id = "fake-multi-message-agent"; + this.Description = "A fake agent that sends multiple messages for testing"; } - public override string Id => this._agentId; + public override string Id { get; } - public override string? Description => this._description; + public override string? Description { get; } public override AgentThread GetNewThread() { diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests.csproj index f87cd59c27..53b9320819 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests.csproj @@ -1,8 +1,7 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) @@ -11,18 +10,18 @@ - - - - - - - - - + + + + + + + + + diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/SharedStateTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/SharedStateTests.cs index 47d9e63520..c96f2d92d0 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/SharedStateTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/SharedStateTests.cs @@ -62,7 +62,7 @@ public async Task StateSnapshot_IsReturnedAsDataContent_WithCorrectMediaTypeAsyn // Verify the state content string receivedJson = System.Text.Encoding.UTF8.GetString(dataContent!.Data.ToArray()); - JsonElement receivedState = JsonSerializer.Deserialize(receivedJson); + JsonElement receivedState = JsonElement.Parse(receivedJson); receivedState.GetProperty("counter").GetInt32().Should().Be(43, "state should be incremented"); receivedState.GetProperty("status").GetString().Should().Be("active"); } @@ -141,7 +141,7 @@ public async Task ComplexState_WithNestedObjectsAndArrays_RoundTripsCorrectlyAsy DataContent? dataContent = stateUpdate!.Contents.OfType().FirstOrDefault(dc => dc.MediaType == "application/json"); string receivedJson = System.Text.Encoding.UTF8.GetString(dataContent!.Data.ToArray()); - JsonElement receivedState = JsonSerializer.Deserialize(receivedJson); + JsonElement receivedState = JsonElement.Parse(receivedJson); receivedState.GetProperty("sessionId").GetString().Should().Be("test-123"); receivedState.GetProperty("nested").GetProperty("count").GetInt32().Should().Be(10); @@ -196,7 +196,7 @@ public async Task StateSnapshot_CanBeUsedInSubsequentRequest_ForStateRoundTripAs DataContent? secondStateContent = secondStateUpdate!.Contents.OfType().FirstOrDefault(dc => dc.MediaType == "application/json"); string secondStateJson = System.Text.Encoding.UTF8.GetString(secondStateContent!.Data.ToArray()); - JsonElement secondState = JsonSerializer.Deserialize(secondStateJson); + JsonElement secondState = JsonElement.Parse(secondStateJson); secondState.GetProperty("counter").GetInt32().Should().Be(3, "counter should be incremented twice: 1 -> 2 -> 3"); } @@ -304,7 +304,7 @@ public async Task NonStreamingRunAsync_WithState_ReturnsStateInResponseAsync() DataContent? dataContent = stateResponseMessage!.Contents.OfType().FirstOrDefault(dc => dc.MediaType == "application/json"); string receivedJson = System.Text.Encoding.UTF8.GetString(dataContent!.Data.ToArray()); - JsonElement receivedState = JsonSerializer.Deserialize(receivedJson); + JsonElement receivedState = JsonElement.Parse(receivedJson); receivedState.GetProperty("counter").GetInt32().Should().Be(6); } @@ -385,7 +385,7 @@ stateObj is JsonElement state && { modifiedState[prop.Name] = prop.Value.GetString(); } - else if (prop.Value.ValueKind == JsonValueKind.Object || prop.Value.ValueKind == JsonValueKind.Array) + else if (prop.Value.ValueKind is JsonValueKind.Object or JsonValueKind.Array) { modifiedState[prop.Name] = prop.Value; } diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/ToolCallingTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/ToolCallingTests.cs index c5ee3d711b..178ed20d73 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/ToolCallingTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/ToolCallingTests.cs @@ -396,7 +396,7 @@ public async Task AGUIChatClientCombinesCustomJsonSerializerOptionsAsync() var json = JsonSerializer.Serialize(testResponse, ClientJsonContext.Default.ClientForecastResponse); // Assert - var jsonElement = JsonDocument.Parse(json).RootElement; + var jsonElement = JsonElement.Parse(json); jsonElement.GetProperty("MaxTemp").GetInt32().Should().Be(75); jsonElement.GetProperty("MinTemp").GetInt32().Should().Be(60); jsonElement.GetProperty("Outlook").GetString().Should().Be("Rainy"); @@ -652,15 +652,15 @@ public async IAsyncEnumerable GetStreamingResponseAsync( return functionName switch { "GetWeather" => new Dictionary { ["location"] = "Seattle" }, - "GetTime" => new Dictionary(), // No parameters + "GetTime" => [], // No parameters "Calculate" => new Dictionary { ["a"] = 5, ["b"] = 3 }, "FormatText" => new Dictionary { ["text"] = "hello" }, - "GetServerData" => new Dictionary(), // No parameters - "GetClientData" => new Dictionary(), // No parameters + "GetServerData" => [], // No parameters + "GetClientData" => [], // No parameters // For custom types, the parameter name is "request" and the value is an instance of the request type "GetServerForecast" => new Dictionary { ["request"] = new ServerForecastRequest("Seattle", 5) }, "GetClientForecast" => new Dictionary { ["request"] = new ClientForecastRequest("Portland", true) }, - _ => new Dictionary() // Default: no parameters + _ => [] // Default: no parameters }; } @@ -689,9 +689,9 @@ public record ClientForecastResponse(int MaxTemp, int MinTemp, string Outlook); [JsonSourceGenerationOptions(WriteIndented = false)] [JsonSerializable(typeof(ServerForecastRequest))] [JsonSerializable(typeof(ServerForecastResponse))] -internal sealed partial class ServerJsonContext : JsonSerializerContext { } +internal sealed partial class ServerJsonContext : JsonSerializerContext; [JsonSourceGenerationOptions(WriteIndented = false)] [JsonSerializable(typeof(ClientForecastRequest))] [JsonSerializable(typeof(ClientForecastResponse))] -internal sealed partial class ClientJsonContext : JsonSerializerContext { } +internal sealed partial class ClientJsonContext : JsonSerializerContext; diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/AGUIEndpointRouteBuilderExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/AGUIEndpointRouteBuilderExtensionsTests.cs index e5fb206147..78a3048747 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/AGUIEndpointRouteBuilderExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/AGUIEndpointRouteBuilderExtensionsTests.cs @@ -38,7 +38,7 @@ public void MapAGUIAgent_MapsEndpoint_AtSpecifiedPattern() AIAgent agent = new TestAgent(); // Act - IEndpointConventionBuilder? result = AGUIEndpointRouteBuilderExtensions.MapAGUI(endpointsMock.Object, Pattern, agent); + IEndpointConventionBuilder? result = endpointsMock.Object.MapAGUI(Pattern, agent); // Assert Assert.NotNull(result); @@ -305,7 +305,7 @@ public async Task MapAGUIAgent_EmitsTextMessageContent_WithCorrectDeltaAsync() public async Task MapAGUIAgent_WithCustomAgent_ProducesExpectedStreamStructureAsync() { // Arrange - AIAgent customAgentFactory(IEnumerable messages, IEnumerable tools, IEnumerable> context, JsonElement props) + static AIAgent CustomAgentFactory(IEnumerable messages, IEnumerable tools, IEnumerable> context, JsonElement props) { return new MultiResponseAgent(); } @@ -322,7 +322,7 @@ AIAgent customAgentFactory(IEnumerable messages, IEnumerable messages, IEnumerable events = ParseSseEvents(responseContent); - List contentEvents = new(); + List contentEvents = []; foreach (JsonElement evt in events) { if (evt.GetProperty("type").GetString() == AGUIEventTypes.TextMessageContent) diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests.csproj index e6d4459c6e..bc6ff0bc70 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests.csproj @@ -1,17 +1,19 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) - - - + + + + + + diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests.csproj index ae816efb7f..61f0592c0a 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests.csproj @@ -1,8 +1,7 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) enable b7762d10-e29b-4bb1-8b74-b6d69a667dd4 diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs index ef9807fddf..0ba879f024 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs @@ -111,7 +111,7 @@ await this.RunSampleTestAsync(samplePath, async (logs) => startResponse.IsSuccessStatusCode, $"Start orchestration failed with status: {startResponse.StatusCode}"); string startResponseText = await startResponse.Content.ReadAsStringAsync(); - JsonElement startResult = JsonSerializer.Deserialize(startResponseText); + JsonElement startResult = JsonElement.Parse(startResponseText); Assert.True(startResult.TryGetProperty("statusQueryGetUri", out JsonElement statusUriElement)); Uri statusUri = new(statusUriElement.GetString()!); @@ -126,7 +126,7 @@ await this.RunSampleTestAsync(samplePath, async (logs) => $"Status check failed with status: {statusResponse.StatusCode}"); string statusText = await statusResponse.Content.ReadAsStringAsync(); - JsonElement statusResult = JsonSerializer.Deserialize(statusText); + JsonElement statusResult = JsonElement.Parse(statusText); Assert.Equal("Completed", statusResult.GetProperty("runtimeStatus").GetString()); Assert.True(statusResult.TryGetProperty("output", out JsonElement outputElement)); @@ -154,7 +154,7 @@ await this.RunSampleTestAsync(samplePath, async (logs) => Assert.True(startResponse.IsSuccessStatusCode, $"Start orchestration failed with status: {startResponse.StatusCode}"); string startResponseText = await startResponse.Content.ReadAsStringAsync(); - JsonElement startResult = JsonSerializer.Deserialize(startResponseText); + JsonElement startResult = JsonElement.Parse(startResponseText); Assert.True(startResult.TryGetProperty("instanceId", out JsonElement instanceIdElement)); Assert.True(startResult.TryGetProperty("statusQueryGetUri", out JsonElement statusUriElement)); @@ -169,7 +169,7 @@ await this.RunSampleTestAsync(samplePath, async (logs) => Assert.True(statusResponse.IsSuccessStatusCode, $"Status check failed with status: {statusResponse.StatusCode}"); string statusText = await statusResponse.Content.ReadAsStringAsync(); - JsonElement statusResult = JsonSerializer.Deserialize(statusText); + JsonElement statusResult = JsonElement.Parse(statusText); Assert.Equal("Completed", statusResult.GetProperty("runtimeStatus").GetString()); Assert.True(statusResult.TryGetProperty("output", out JsonElement outputElement)); @@ -233,7 +233,7 @@ await this.RunSampleTestAsync(samplePath, async (logs) => startResponse.IsSuccessStatusCode, $"Start HITL orchestration failed with status: {startResponse.StatusCode}"); string startResponseText = await startResponse.Content.ReadAsStringAsync(); - JsonElement startResult = JsonSerializer.Deserialize(startResponseText); + JsonElement startResult = JsonElement.Parse(startResponseText); Assert.True(startResult.TryGetProperty("statusQueryGetUri", out JsonElement statusUriElement)); Uri statusUri = new(statusUriElement.GetString()!); @@ -250,7 +250,7 @@ await this.RunSampleTestAsync(samplePath, async (logs) => string statusText = await statusResponse.Content.ReadAsStringAsync(); this._outputHelper.WriteLine($"HITL orchestration status text: {statusText}"); - JsonElement statusResult = JsonSerializer.Deserialize(statusText); + JsonElement statusResult = JsonElement.Parse(statusText); // The orchestration should complete with a failed status due to timeout Assert.Equal("Failed", statusResult.GetProperty("runtimeStatus").GetString()); @@ -423,7 +423,7 @@ private async Task TestSpamDetectionAsync(string emailId, string emailContent, b Assert.True(startResponse.IsSuccessStatusCode, $"Start orchestration failed with status: {startResponse.StatusCode}"); string startResponseText = await startResponse.Content.ReadAsStringAsync(); - JsonElement startResult = JsonSerializer.Deserialize(startResponseText); + JsonElement startResult = JsonElement.Parse(startResponseText); Assert.True(startResult.TryGetProperty("statusQueryGetUri", out JsonElement statusUriElement)); Uri statusUri = new(statusUriElement.GetString()!); @@ -436,7 +436,7 @@ private async Task TestSpamDetectionAsync(string emailId, string emailContent, b Assert.True(statusResponse.IsSuccessStatusCode, $"Status check failed with status: {statusResponse.StatusCode}"); string statusText = await statusResponse.Content.ReadAsStringAsync(); - JsonElement statusResult = JsonSerializer.Deserialize(statusText); + JsonElement statusResult = JsonElement.Parse(statusText); Assert.Equal("Completed", statusResult.GetProperty("runtimeStatus").GetString()); Assert.True(statusResult.TryGetProperty("output", out JsonElement outputElement)); @@ -722,15 +722,12 @@ private async Task WaitForOrchestrationCompletionAsync(Uri statusUri) if (response.IsSuccessStatusCode) { string responseText = await response.Content.ReadAsStringAsync(timeoutCts.Token); - JsonElement result = JsonSerializer.Deserialize(responseText); + JsonElement result = JsonElement.Parse(responseText); - if (result.TryGetProperty("runtimeStatus", out JsonElement statusElement)) + if (result.TryGetProperty("runtimeStatus", out JsonElement statusElement) && + statusElement.GetString() is "Completed" or "Failed" or "Terminated") { - string status = statusElement.GetString()!; - if (status == "Completed" || status == "Failed" || status == "Terminated") - { - return; - } + return; } } } diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/DurableAgentFunctionMetadataTransformerTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/DurableAgentFunctionMetadataTransformerTests.cs index c9a13d7298..7d3a2ec13e 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/DurableAgentFunctionMetadataTransformerTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/DurableAgentFunctionMetadataTransformerTests.cs @@ -134,7 +134,7 @@ static FunctionsAgentOptions CreateFunctionsAgentOptions(bool httpEnabled, bool Assert.Contains($"agents/{agentName}/run", httpMeta.RawBindings[0]); // We expect 2 mcp tool triggers only for agentB and agentC - if (agentName == "agentB" || agentName == "agentC") + if (agentName is "agentB" or "agentC") { DefaultFunctionMetadata? mcpToolMeta = Assert.Single(metadataList, m => m.Name == $"mcptool-{agentName}") as DefaultFunctionMetadata; diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests.csproj index d3842800b9..7b053abe83 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests.csproj @@ -1,8 +1,7 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) enable diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ContentTypeEventGeneratorTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ContentTypeEventGeneratorTests.cs index 5a8f4ea442..1be9d06ca7 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ContentTypeEventGeneratorTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ContentTypeEventGeneratorTests.cs @@ -47,7 +47,7 @@ public async Task TextReasoningContent_GeneratesReasoningItem_SuccessAsync() var firstItemAddedEvent = events.First(e => e.GetProperty("type").GetString() == "response.output_item.added"); var firstItem = firstItemAddedEvent.GetProperty("item"); Assert.Equal("reasoning", firstItem.GetProperty("type").GetString()); - Assert.True(firstItemAddedEvent.GetProperty("output_index").GetInt32() == 0); + Assert.Equal(0, firstItemAddedEvent.GetProperty("output_index").GetInt32()); // Verify reasoning item done var firstItemDoneEvent = events.First(e => @@ -153,7 +153,7 @@ public async Task ErrorContent_GeneratesRefusalItem_SuccessAsync() // Verify item added event var itemAddedEvent = events.FirstOrDefault(e => e.GetProperty("type").GetString() == "response.output_item.added"); - Assert.True(itemAddedEvent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, itemAddedEvent.ValueKind); var item = itemAddedEvent.GetProperty("item"); Assert.Equal("message", item.GetProperty("type").GetString()); @@ -166,7 +166,7 @@ public async Task ErrorContent_GeneratesRefusalItem_SuccessAsync() Assert.NotEmpty(contentArray); var refusalContent = contentArray.First(c => c.GetProperty("type").GetString() == "refusal"); - Assert.True(refusalContent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, refusalContent.ValueKind); Assert.Equal(ErrorMessage, refusalContent.GetProperty("refusal").GetString()); } @@ -246,12 +246,12 @@ public async Task ImageContent_UriContent_GeneratesImageItem_SuccessAsync() // Assert var itemAddedEvent = events.FirstOrDefault(e => e.GetProperty("type").GetString() == "response.output_item.added"); - Assert.True(itemAddedEvent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, itemAddedEvent.ValueKind); var content = itemAddedEvent.GetProperty("item").GetProperty("content"); var imageContent = content.EnumerateArray().First(c => c.GetProperty("type").GetString() == "input_image"); - Assert.True(imageContent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, imageContent.ValueKind); Assert.Equal(ImageUrl, imageContent.GetProperty("image_url").GetString()); } @@ -270,12 +270,12 @@ public async Task ImageContent_DataContent_GeneratesImageItem_SuccessAsync() // Assert var itemAddedEvent = events.FirstOrDefault(e => e.GetProperty("type").GetString() == "response.output_item.added"); - Assert.True(itemAddedEvent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, itemAddedEvent.ValueKind); var content = itemAddedEvent.GetProperty("item").GetProperty("content"); var imageContent = content.EnumerateArray().First(c => c.GetProperty("type").GetString() == "input_image"); - Assert.True(imageContent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, imageContent.ValueKind); Assert.Equal(DataUri, imageContent.GetProperty("image_url").GetString()); } @@ -295,12 +295,12 @@ public async Task ImageContent_WithDetailProperty_IncludesDetail_SuccessAsync() // Assert var itemAddedEvent = events.FirstOrDefault(e => e.GetProperty("type").GetString() == "response.output_item.added"); - Assert.True(itemAddedEvent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, itemAddedEvent.ValueKind); var content = itemAddedEvent.GetProperty("item").GetProperty("content"); var imageContent = content.EnumerateArray().First(c => c.GetProperty("type").GetString() == "input_image"); - Assert.True(imageContent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, imageContent.ValueKind); Assert.True(imageContent.TryGetProperty("detail", out var detailProp)); Assert.Equal(Detail, detailProp.GetString()); } @@ -345,12 +345,12 @@ public async Task AudioContent_Mp3Format_GeneratesAudioItem_SuccessAsync() // Assert var itemAddedEvent = events.FirstOrDefault(e => e.GetProperty("type").GetString() == "response.output_item.added"); - Assert.True(itemAddedEvent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, itemAddedEvent.ValueKind); var content = itemAddedEvent.GetProperty("item").GetProperty("content"); var audioContent = content.EnumerateArray().First(c => c.GetProperty("type").GetString() == "input_audio"); - Assert.True(audioContent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, audioContent.ValueKind); Assert.Equal(AudioDataUri, audioContent.GetProperty("data").GetString()); Assert.Equal("mp3", audioContent.GetProperty("format").GetString()); } @@ -421,12 +421,12 @@ public async Task HostedFileContent_GeneratesFileItem_SuccessAsync() // Assert var itemAddedEvent = events.FirstOrDefault(e => e.GetProperty("type").GetString() == "response.output_item.added"); - Assert.True(itemAddedEvent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, itemAddedEvent.ValueKind); var content = itemAddedEvent.GetProperty("item").GetProperty("content"); var fileContent = content.EnumerateArray().First(c => c.GetProperty("type").GetString() == "input_file"); - Assert.True(fileContent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, fileContent.ValueKind); Assert.Equal(FileId, fileContent.GetProperty("file_id").GetString()); } @@ -471,12 +471,12 @@ public async Task FileContent_WithDataUri_GeneratesFileItem_SuccessAsync() // Assert var itemAddedEvent = events.FirstOrDefault(e => e.GetProperty("type").GetString() == "response.output_item.added"); - Assert.True(itemAddedEvent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, itemAddedEvent.ValueKind); var content = itemAddedEvent.GetProperty("item").GetProperty("content"); var fileContent = content.EnumerateArray().First(c => c.GetProperty("type").GetString() == "input_file"); - Assert.True(fileContent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, fileContent.ValueKind); Assert.Equal(FileDataUri, fileContent.GetProperty("file_data").GetString()); Assert.Equal(Filename, fileContent.GetProperty("filename").GetString()); } @@ -499,7 +499,7 @@ public async Task FileContent_WithoutFilename_GeneratesFileItemWithoutFilename_S var content = itemAddedEvent.GetProperty("item").GetProperty("content"); var fileContent = content.EnumerateArray().First(c => c.GetProperty("type").GetString() == "input_file"); - Assert.True(fileContent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, fileContent.ValueKind); Assert.Equal(FileDataUri, fileContent.GetProperty("file_data").GetString()); // filename property might be null or absent } diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/FunctionApprovalTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/FunctionApprovalTests.cs index c9a76e4990..296217f931 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/FunctionApprovalTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/FunctionApprovalTests.cs @@ -95,7 +95,7 @@ public async Task FunctionApprovalRequest_WithComplexArguments_GeneratesCorrectE // Assert JsonElement approvalEvent = events.FirstOrDefault(e => e.GetProperty("type").GetString() == "response.function_approval.requested"); - Assert.True(approvalEvent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, approvalEvent.ValueKind); JsonElement functionCallElement = approvalEvent.GetProperty("function_call"); JsonElement argumentsElement = functionCallElement.GetProperty("arguments"); @@ -235,7 +235,7 @@ public async Task FunctionApprovalResponse_Rejected_GeneratesCorrectEvent_Succes // Assert JsonElement approvalEvent = events.FirstOrDefault(e => e.GetProperty("type").GetString() == "response.function_approval.responded"); - Assert.True(approvalEvent.ValueKind != JsonValueKind.Undefined); + Assert.NotEqual(JsonValueKind.Undefined, approvalEvent.ValueKind); Assert.Equal(RequestId, approvalEvent.GetProperty("request_id").GetString()); Assert.False(approvalEvent.GetProperty("approved").GetBoolean()); @@ -340,7 +340,7 @@ public async Task MixedContent_MultipleApprovalRequests_GeneratesMultipleEvents_ private static List ParseSseEvents(string sseContent) { - List events = new(); + List events = []; string[] lines = sseContent.Split('\n'); for (int i = 0; i < lines.Length; i++) diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj index 7d64f7ae2b..17d9742436 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj @@ -1,18 +1,19 @@  - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) false $(NoWarn);OPENAI001;CA1812 - - + - - + + + + + diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIChatCompletionsConformanceTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIChatCompletionsConformanceTests.cs index 8a38389035..ad7e6410f8 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIChatCompletionsConformanceTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIChatCompletionsConformanceTests.cs @@ -138,7 +138,7 @@ public async Task BasicRequestResponseAsync() AssertJsonPropertyExists(response, "service_tier"); var serviceTier = response.GetProperty("service_tier").GetString(); Assert.NotNull(serviceTier); - Assert.True(serviceTier == "default" || serviceTier == "auto", $"service_tier should be 'default' or 'auto', got '{serviceTier}'"); + Assert.True(serviceTier is "default" or "auto", $"service_tier should be 'default' or 'auto', got '{serviceTier}'"); } [Fact] diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIConversationsSerializationTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIConversationsSerializationTests.cs index ecbdba4a53..7dc700abe6 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIConversationsSerializationTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIConversationsSerializationTests.cs @@ -329,7 +329,7 @@ public void Deserialize_AllItemResponses_HaveRequiredFields() Assert.NotNull(item); Assert.NotNull(item.Id); Assert.Equal("message", item.Type); - var messageItem = Assert.IsAssignableFrom(item); + var messageItem = Assert.IsType(item, exactMatch: false); // Content is on concrete message types (ResponsesAssistantMessageItemResource, etc.) // For this test, we just verify the type is correct Assert.NotNull(messageItem); diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIHttpApiIntegrationTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIHttpApiIntegrationTests.cs index 1a72b252b5..a76820fff1 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIHttpApiIntegrationTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/OpenAIHttpApiIntegrationTests.cs @@ -209,7 +209,7 @@ public async Task CreateConversationAndResponse_NonStreaming_Background_UpdatesC // Assert - Response is in progress or queued string status = response.GetProperty("status").GetString()!; - Assert.True(status == "in_progress" || status == "queued" || status == "completed", $"Expected 'in_progress', 'queued', or 'completed', got '{status}'"); + Assert.True(status is "in_progress" or "queued" or "completed", $"Expected 'in_progress', 'queued', or 'completed', got '{status}'"); string responseId = response.GetProperty("id").GetString()!; // Wait for completion by polling diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/TestHelpers.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/TestHelpers.cs index 11a0c1940d..c3054e0296 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/TestHelpers.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/TestHelpers.cs @@ -516,7 +516,7 @@ public ToolCallMockChatClient(string functionName, string argumentsJson) this._functionName = functionName; // Parse JSON arguments into dictionary using var doc = System.Text.Json.JsonDocument.Parse(argumentsJson); - this._arguments = new Dictionary(); + this._arguments = []; foreach (var prop in doc.RootElement.EnumerateObject()) { this._arguments[prop.Name] = prop.Value.ValueKind switch diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/AgentHostingServiceCollectionExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/AgentHostingServiceCollectionExtensionsTests.cs index 3d96567e85..03ab65c9f2 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/AgentHostingServiceCollectionExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/AgentHostingServiceCollectionExtensionsTests.cs @@ -58,7 +58,7 @@ public void AddAIAgentWithKey_NullName_ThrowsArgumentNullException() public void AddAIAgentWithKey_NullInstructions_AllowsNull() { var services = new ServiceCollection(); - var result = services.AddAIAgent("agentName", null!, "key"); + var result = services.AddAIAgent("agentName", null, "key"); Assert.NotNull(result); } diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderAgentExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderAgentExtensionsTests.cs index a29a6208f9..0036a60cc7 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderAgentExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderAgentExtensionsTests.cs @@ -67,7 +67,7 @@ public void AddAIAgentWithKey_NullName_ThrowsArgumentNullException() public void AddAIAgentWithKey_NullInstructions_AllowsNull() { var builder = new HostApplicationBuilder(); - var result = builder.AddAIAgent("agentName", null!, "key"); + var result = builder.AddAIAgent("agentName", null, "key"); Assert.NotNull(result); } diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs index a1b7d29f55..d27b9a17e3 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs @@ -59,7 +59,7 @@ public void AddWorkflow_ValidParameters_ReturnsBuilder() var result = builder.AddWorkflow("workflowName", (sp, key) => CreateTestWorkflow(key)); Assert.NotNull(result); - Assert.IsAssignableFrom(result); + Assert.IsType(result, exactMatch: false); } /// @@ -234,7 +234,7 @@ public void AddAsAIAgent_ReturnsHostedAgentBuilder() var agentBuilder = workflowBuilder.AddAsAIAgent(AgentName); Assert.NotNull(agentBuilder); - Assert.IsAssignableFrom(agentBuilder); + Assert.IsType(agentBuilder, exactMatch: false); Assert.Equal(AgentName, agentBuilder.Name); } @@ -251,7 +251,7 @@ public void AddAsAIAgent_WithoutName_ReturnsHostedAgentBuilderWithWorkflowName() var agentBuilder = workflowBuilder.AddAsAIAgent(); Assert.NotNull(agentBuilder); - Assert.IsAssignableFrom(agentBuilder); + Assert.IsType(agentBuilder, exactMatch: false); Assert.Equal(WorkflowName, agentBuilder.Name); } diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostedAgentBuilderToolsExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostedAgentBuilderToolsExtensionsTests.cs index 9993007de1..a229c7e1f8 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostedAgentBuilderToolsExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/HostedAgentBuilderToolsExtensionsTests.cs @@ -118,9 +118,7 @@ private static IList ResolveAgentTools(IServiceProvider serviceProvider, /// /// Dummy AITool implementation for testing. /// - private sealed class DummyAITool : AITool - { - } + private sealed class DummyAITool : AITool; /// /// Mock chat client for testing. diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/Microsoft.Agents.AI.Hosting.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/Microsoft.Agents.AI.Hosting.UnitTests.csproj index 087c58ca92..1279b20397 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/Microsoft.Agents.AI.Hosting.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.UnitTests/Microsoft.Agents.AI.Hosting.UnitTests.csproj @@ -1,8 +1,7 @@ - $(ProjectsCoreTargetFrameworks) - $(ProjectsDebugCoreTargetFrameworks) + $(TargetFrameworksCore) diff --git a/dotnet/tests/Microsoft.Agents.AI.Mem0.IntegrationTests/Microsoft.Agents.AI.Mem0.IntegrationTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Mem0.IntegrationTests/Microsoft.Agents.AI.Mem0.IntegrationTests.csproj index 190d38e1dd..99b028963a 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Mem0.IntegrationTests/Microsoft.Agents.AI.Mem0.IntegrationTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Mem0.IntegrationTests/Microsoft.Agents.AI.Mem0.IntegrationTests.csproj @@ -1,8 +1,6 @@ - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) True diff --git a/dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Mem0ProviderTests.cs b/dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Mem0ProviderTests.cs index 8cfc0bf401..0515c8e7ac 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Mem0ProviderTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Mem0ProviderTests.cs @@ -92,7 +92,7 @@ public async Task InvokingAsync_PerformsSearch_AndReturnsContextMessageAsync() UserId = "user" }; var sut = new Mem0Provider(this._httpClient, storageScope, options: new() { EnableSensitiveTelemetryData = true }, loggerFactory: this._loggerFactoryMock.Object); - var invokingContext = new AIContextProvider.InvokingContext(new[] { new ChatMessage(ChatRole.User, "What is my name?") }); + var invokingContext = new AIContextProvider.InvokingContext([new ChatMessage(ChatRole.User, "What is my name?")]); // Act var aiContext = await sut.InvokingAsync(invokingContext); @@ -419,7 +419,7 @@ public void Dispose() private sealed class RecordingHandler : HttpMessageHandler { private readonly Queue _responses = new(); - public List<(HttpRequestMessage RequestMessage, string RequestBody)> Requests { get; } = new(); + public List<(HttpRequestMessage RequestMessage, string RequestBody)> Requests { get; } = []; protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { diff --git a/dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Microsoft.Agents.AI.Mem0.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Microsoft.Agents.AI.Mem0.UnitTests.csproj index 1836f437d5..5abb64ca22 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Microsoft.Agents.AI.Mem0.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Mem0.UnitTests/Microsoft.Agents.AI.Mem0.UnitTests.csproj @@ -1,9 +1,5 @@  - - $(ProjectsTargetFrameworks) - - false diff --git a/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Microsoft.Agents.AI.OpenAI.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Microsoft.Agents.AI.OpenAI.UnitTests.csproj index 7f26fdc132..515ca2fb8d 100644 --- a/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Microsoft.Agents.AI.OpenAI.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Microsoft.Agents.AI.OpenAI.UnitTests.csproj @@ -1,9 +1,5 @@ - - $(ProjectsTargetFrameworks) - - diff --git a/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/Microsoft.Agents.AI.Purview.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/Microsoft.Agents.AI.Purview.UnitTests.csproj index bd07eca8ab..0129bba5d1 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/Microsoft.Agents.AI.Purview.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/Microsoft.Agents.AI.Purview.UnitTests.csproj @@ -1,9 +1,5 @@  - - $(ProjectsTargetFrameworks) - - diff --git a/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/PurviewClientTests.cs b/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/PurviewClientTests.cs index b2b0ac45e6..3e45d8d4bd 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/PurviewClientTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/PurviewClientTests.cs @@ -220,10 +220,10 @@ public async Task GetProtectionScopesAsync_WithValidRequest_ReturnsSuccessRespon var request = new ProtectionScopesRequest("test-user-id", "test-tenant-id") { Activities = ProtectionScopeActivities.UploadText, - Locations = new List - { + Locations = + [ new("microsoft.graph.policyLocationApplication", "app-123") - } + ] }; var expectedResponse = new ProtectionScopesResponse @@ -233,10 +233,10 @@ public async Task GetProtectionScopesAsync_WithValidRequest_ReturnsSuccessRespon new() { Activities = ProtectionScopeActivities.UploadText, - Locations = new List - { + Locations = + [ new ("microsoft.graph.policyLocationApplication", "app-123") - } + ] } } }; @@ -502,7 +502,7 @@ private static ContentToProcess CreateValidContentToProcess() }; return new ContentToProcess( - new List { metadata }, + [metadata], activityMetadata, deviceMetadata, integratedAppMetadata, @@ -554,9 +554,10 @@ protected override async Task SendAsync(HttpRequestMessage throw new HttpRequestException("Simulated network error"); } - var response = new HttpResponseMessage(this.StatusCodeToReturn); - - response.Content = new StringContent(this.ResponseToReturn ?? string.Empty, Encoding.UTF8, "application/json"); + var response = new HttpResponseMessage(this.StatusCodeToReturn) + { + Content = new StringContent(this.ResponseToReturn ?? string.Empty, Encoding.UTF8, "application/json") + }; if (!string.IsNullOrEmpty(this.ETagToReturn)) { diff --git a/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/ScopedContentProcessorTests.cs b/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/ScopedContentProcessorTests.cs index f43f086de7..9d56e0bc50 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/ScopedContentProcessorTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/ScopedContentProcessorTests.cs @@ -61,10 +61,10 @@ public async Task ProcessMessagesAsync_WithBlockAccessAction_ReturnsShouldBlockT new() { Activities = ProtectionScopeActivities.UploadText, - Locations = new List - { + Locations = + [ new ("microsoft.graph.policyLocationApplication", "app-123") - }, + ], ExecutionMode = ExecutionMode.EvaluateInline } } @@ -120,10 +120,10 @@ public async Task ProcessMessagesAsync_WithRestrictionActionBlock_ReturnsShouldB new() { Activities = ProtectionScopeActivities.UploadText, - Locations = new List - { + Locations = + [ new ("microsoft.graph.policyLocationApplication", "app-123") - }, + ], ExecutionMode = ExecutionMode.EvaluateInline } } @@ -179,10 +179,10 @@ public async Task ProcessMessagesAsync_WithNoBlockingActions_ReturnsShouldBlockF new() { Activities = ProtectionScopeActivities.UploadText, - Locations = new List - { + Locations = + [ new("microsoft.graph.policyLocationApplication", "app-123") - }, + ], ExecutionMode = ExecutionMode.EvaluateInline } } @@ -234,10 +234,10 @@ public async Task ProcessMessagesAsync_UsesCachedProtectionScopes_WhenAvailableA new() { Activities = ProtectionScopeActivities.UploadText, - Locations = new List - { + Locations = + [ new ("microsoft.graph.policyLocationApplication", "app-123") - }, + ], ExecutionMode = ExecutionMode.EvaluateInline } } @@ -290,10 +290,10 @@ public async Task ProcessMessagesAsync_InvalidatesCache_WhenProtectionScopeModif new() { Activities = ProtectionScopeActivities.UploadText, - Locations = new List - { + Locations = + [ new ("microsoft.graph.policyLocationApplication", "app-123") - }, + ], ExecutionMode = ExecutionMode.EvaluateInline } } @@ -347,10 +347,10 @@ public async Task ProcessMessagesAsync_SendsContentActivities_WhenNoApplicableSc new() { Activities = ProtectionScopeActivities.UploadText, - Locations = new List - { + Locations = + [ new ("microsoft.graph.policyLocationApplication", "app-456") - } + ] } } }; diff --git a/dotnet/tests/Microsoft.Agents.AI.UnitTests/AIAgentBuilderTests.cs b/dotnet/tests/Microsoft.Agents.AI.UnitTests/AIAgentBuilderTests.cs index ca5803bba4..7f455327dc 100644 --- a/dotnet/tests/Microsoft.Agents.AI.UnitTests/AIAgentBuilderTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.UnitTests/AIAgentBuilderTests.cs @@ -257,11 +257,10 @@ public void BuildsPipelineInOrderAdded() { // Arrange var mockInnerAgent = new Mock(); - var builder = new AIAgentBuilder(mockInnerAgent.Object); - - builder.Use(next => new InnerAgentCapturingAgent("First", next)); - builder.Use(next => new InnerAgentCapturingAgent("Second", next)); - builder.Use(next => new InnerAgentCapturingAgent("Third", next)); + var builder = new AIAgentBuilder(mockInnerAgent.Object) + .Use(next => new InnerAgentCapturingAgent("First", next)) + .Use(next => new InnerAgentCapturingAgent("Second", next)) + .Use(next => new InnerAgentCapturingAgent("Third", next)); // Act var first = (InnerAgentCapturingAgent)builder.Build(); @@ -306,7 +305,7 @@ public void UsesEmptyServiceProviderWhenNoServicesProvided() { Assert.Null(serviceProvider.GetService(typeof(object))); - var keyedServiceProvider = Assert.IsAssignableFrom(serviceProvider); + var keyedServiceProvider = Assert.IsType(serviceProvider, exactMatch: false); Assert.Null(keyedServiceProvider.GetKeyedService(typeof(object), "key")); Assert.Throws(() => keyedServiceProvider.GetRequiredKeyedService(typeof(object), "key")); diff --git a/dotnet/tests/Microsoft.Agents.AI.UnitTests/Data/TextSearchProviderTests.cs b/dotnet/tests/Microsoft.Agents.AI.UnitTests/Data/TextSearchProviderTests.cs index be1e901499..b32211e883 100644 --- a/dotnet/tests/Microsoft.Agents.AI.UnitTests/Data/TextSearchProviderTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.UnitTests/Data/TextSearchProviderTests.cs @@ -60,11 +60,11 @@ public async Task InvokingAsync_ShouldInjectFormattedResultsAsync(string? overri }; var provider = new TextSearchProvider(SearchDelegateAsync, default, null, options, withLogging ? this._loggerFactoryMock.Object : null); - var invokingContext = new AIContextProvider.InvokingContext(new[] - { + var invokingContext = new AIContextProvider.InvokingContext( + [ new ChatMessage(ChatRole.User, "Sample user question?"), new ChatMessage(ChatRole.User, "Additional part") - }); + ]); // Act var aiContext = await provider.InvokingAsync(invokingContext, CancellationToken.None); @@ -441,7 +441,7 @@ public async Task InvokingAsync_WithRecentMessageRolesIncluded_ShouldFilterRoles { SearchTime = TextSearchProviderOptions.TextSearchBehavior.BeforeAIInvoke, RecentMessageMemoryLimit = 4, - RecentMessageRolesIncluded = new List { ChatRole.Assistant } // Only retain assistant messages. + RecentMessageRolesIncluded = [ChatRole.Assistant] // Only retain assistant messages. }; string? capturedInput = null; Task> SearchDelegateAsync(string input, CancellationToken ct) diff --git a/dotnet/tests/Microsoft.Agents.AI.UnitTests/Memory/ChatHistoryMemoryProviderTests.cs b/dotnet/tests/Microsoft.Agents.AI.UnitTests/Memory/ChatHistoryMemoryProviderTests.cs index 1cb841bd2c..860867f8a2 100644 --- a/dotnet/tests/Microsoft.Agents.AI.UnitTests/Memory/ChatHistoryMemoryProviderTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.UnitTests/Memory/ChatHistoryMemoryProviderTests.cs @@ -259,7 +259,7 @@ public async Task InvokedAsync_LogsUserIdBasedOnEnableSensitiveTelemetryDataAsyn Assert.Equal(expectedLogInvocations, this._loggerMock.Invocations.Count); foreach (var logInvocation in this._loggerMock.Invocations) { - var state = Assert.IsAssignableFrom>>(logInvocation.Arguments[2]); + var state = Assert.IsType>>(logInvocation.Arguments[2], exactMatch: false); var userIdValue = state.First(kvp => kvp.Key == "UserId").Value; Assert.Equal(enableSensitiveTelemetryData ? "user1" : "", userIdValue); } diff --git a/dotnet/tests/Microsoft.Agents.AI.UnitTests/Microsoft.Agents.AI.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.UnitTests/Microsoft.Agents.AI.UnitTests.csproj index f871781d03..7e25c9ae0f 100644 --- a/dotnet/tests/Microsoft.Agents.AI.UnitTests/Microsoft.Agents.AI.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.UnitTests/Microsoft.Agents.AI.UnitTests.csproj @@ -1,9 +1,5 @@ - - $(ProjectsTargetFrameworks) - - false @@ -17,7 +13,7 @@ - + diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/IntegrationTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/IntegrationTest.cs index b525749b6c..cf17694ccb 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/IntegrationTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/IntegrationTest.cs @@ -19,9 +19,7 @@ namespace Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.Framework; /// public abstract class IntegrationTest : IDisposable { - private IConfigurationRoot? _configuration; - - protected IConfigurationRoot Configuration => this._configuration ??= InitializeConfig(); + protected IConfigurationRoot Configuration => field ??= InitializeConfig(); public Uri TestEndpoint { get; } @@ -32,7 +30,7 @@ protected IntegrationTest(ITestOutputHelper output) this.Output = new TestOutputAdapter(output); this.TestEndpoint = new Uri( - this.Configuration[AgentProvider.Settings.FoundryEndpoint] ?? + this.Configuration?[AgentProvider.Settings.FoundryEndpoint] ?? throw new InvalidOperationException($"Undefined configuration setting: {AgentProvider.Settings.FoundryEndpoint}")); Console.SetOut(this.Output); SetProduct(); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/FunctionCallingWorkflowTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/FunctionCallingWorkflowTest.cs index 3238c59b54..63e052481a 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/FunctionCallingWorkflowTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/FunctionCallingWorkflowTest.cs @@ -7,7 +7,6 @@ using System.Text.Json; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Events; -using Microsoft.Agents.AI.Workflows.Declarative.Extensions; using Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.Agents; using Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.Framework; using Microsoft.Agents.AI.Workflows.Declarative.Kit; diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj index 9e86f4250a..985086a56e 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj @@ -1,9 +1,5 @@  - - $(ProjectsTargetFrameworks) - - true true @@ -24,7 +20,7 @@ - + diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ObjectExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ObjectExtensionsTests.cs index d7610c3312..54343f042a 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ObjectExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ObjectExtensionsTests.cs @@ -107,7 +107,7 @@ public void ConvertJson() private static void VerifyConversion(object? sourceValue, VariableType targetType, object? expectedValue) { object? actualValue = sourceValue.ConvertType(targetType); - if (expectedValue is IDictionary || expectedValue is DateTime) + if (expectedValue is IDictionary or DateTime) { Assert.Equivalent(expectedValue, actualValue); } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj index 491ec95778..594c0b3857 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj @@ -1,9 +1,5 @@  - - $(ProjectsTargetFrameworks) - - true true @@ -18,7 +14,7 @@ - + diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/UpdateBaseline.ps1 b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/UpdateBaseline.ps1 index 56359529aa..6f6d461884 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/UpdateBaseline.ps1 +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/UpdateBaseline.ps1 @@ -1,7 +1,7 @@ -$generatedCodeFiles = Get-ChildItem -Name -Path .\bin\Debug\net9.0\Workflows -Filter *.g.cs +$generatedCodeFiles = Get-ChildItem -Name -Path .\bin\Debug\net10.0\Workflows -Filter *.g.cs Write-Output "x$($generatedCodeFiles.Count)" foreach ($file in $generatedCodeFiles) { $baselineFile = $file -replace '\.g\.cs$', '.cs' Write-Output $baselineFile - Copy-Item -Path ".\bin\Debug\net9.0\Workflows\$file" -Destination ".\Workflows\$baselineFile" -Force + Copy-Item -Path ".\bin\Debug\net10.0\Workflows\$file" -Destination ".\Workflows\$baselineFile" -Force } \ No newline at end of file diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs index cffdb8c73c..e134f10aa7 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs @@ -111,7 +111,7 @@ public async Task RunAsyncAndStreamAsyncShouldProduceSimilarResultsAsync() await using StreamingRun streamingRun = await InProcessExecution.StreamAsync(workflow2, new List { inputMessage }); await streamingRun.TrySendMessageAsync(new TurnToken(emitEvents: true)); - List streamingEvents = new(); + List streamingEvents = []; await foreach (WorkflowEvent evt in streamingRun.WatchStreamAsync()) { streamingEvents.Add(evt); @@ -137,14 +137,12 @@ public async Task RunAsyncAndStreamAsyncShouldProduceSimilarResultsAsync() /// private sealed class SimpleTestAgent : AIAgent { - private readonly string _name; - public SimpleTestAgent(string name) { - this._name = name; + this.Name = name; } - public override string Name => this._name; + public override string Name { get; } public override AgentThread GetNewThread() => new SimpleTestAgentThread(); @@ -176,16 +174,16 @@ public override async IAsyncEnumerable RunStreamingAsync string messageId = Guid.NewGuid().ToString("N"); // Yield role first - yield return new AgentRunResponseUpdate(ChatRole.Assistant, this._name) + yield return new AgentRunResponseUpdate(ChatRole.Assistant, this.Name) { - AuthorName = this._name, + AuthorName = this.Name, MessageId = messageId }; // Then yield content yield return new AgentRunResponseUpdate(ChatRole.Assistant, responseText) { - AuthorName = this._name, + AuthorName = this.Name, MessageId = messageId }; } @@ -194,7 +192,5 @@ public override async IAsyncEnumerable RunStreamingAsync /// /// Simple thread implementation for SimpleTestAgent. /// - private sealed class SimpleTestAgentThread : InMemoryAgentThread - { - } + private sealed class SimpleTestAgentThread : InMemoryAgentThread; } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessStateTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessStateTests.cs index 014c51b3c0..0ecd6bfac1 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessStateTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessStateTests.cs @@ -145,7 +145,7 @@ public async Task InProcessRun_StateShouldPersist_CheckpointedAsync() [Fact] public async Task InProcessRun_StateShouldError_TwoExecutorsAsync() { - ForwardMessageExecutor forward = new(nameof(ForwardMessageExecutor)); + ForwardMessageExecutor forward = new(nameof(ForwardMessageExecutor<>)); using StateTestExecutor testExecutor = new( new ScopeKey("StateTestExecutor", "TestScope", "TestKey"), loop: false, diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Microsoft.Agents.AI.Workflows.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Microsoft.Agents.AI.Workflows.UnitTests.csproj index bd9bc57915..60dac38ecd 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Microsoft.Agents.AI.Workflows.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Microsoft.Agents.AI.Workflows.UnitTests.csproj @@ -1,7 +1,6 @@  - $(ProjectsTargetFrameworks) $(NoWarn);MEAI001 @@ -13,7 +12,7 @@ - + diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ObservabilityTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ObservabilityTests.cs index 7101ad13d4..8ab6280b46 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ObservabilityTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ObservabilityTests.cs @@ -33,7 +33,7 @@ public ObservabilityTests() this._activityListener = new ActivityListener { ShouldListenTo = source => source.Name.Contains(typeof(Workflow).Namespace!), - Sample = (ref ActivityCreationOptions options) => ActivitySamplingResult.AllData, + Sample = (ref options) => ActivitySamplingResult.AllData, ActivityStarted = activity => this._capturedActivities.Add(activity), }; ActivitySource.AddActivityListener(this._activityListener); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ReflectionSmokeTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ReflectionSmokeTest.cs index 5027028387..ccf3f7bc8b 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ReflectionSmokeTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ReflectionSmokeTest.cs @@ -35,7 +35,7 @@ public Func Handler } = (message, context) => default; } -public class TypedHandler() : BaseTestExecutor>(nameof(TypedHandler)), IMessageHandler +public class TypedHandler() : BaseTestExecutor>(nameof(TypedHandler<>)), IMessageHandler { public ValueTask HandleAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken = default) { @@ -50,7 +50,7 @@ public Func Handler } = (message, context) => default; } -public class TypedHandlerWithOutput() : BaseTestExecutor>(nameof(TypedHandlerWithOutput)), IMessageHandler +public class TypedHandlerWithOutput() : BaseTestExecutor>(nameof(TypedHandlerWithOutput<,>)), IMessageHandler { public ValueTask HandleAsync(TInput message, IWorkflowContext context, CancellationToken cancellationToken) { diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/08_Subworkflow_Simple.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/08_Subworkflow_Simple.cs index 58372103f4..98f46cf551 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/08_Subworkflow_Simple.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/08_Subworkflow_Simple.cs @@ -81,8 +81,8 @@ private sealed class TextProcessingOrchestrator(string id) { internal sealed class State { - public List Results { get; } = new(); - public HashSet PendingTaskIds { get; } = new(); + public List Results { get; } = []; + public HashSet PendingTaskIds { get; } = []; public bool IsComplete => this.PendingTaskIds.Count == 0; @@ -102,7 +102,7 @@ private async ValueTask StartProcessingAsync(List texts, IWorkflowContex async ValueTask QueueProcessingTasksAsync(State state, IWorkflowContext context, CancellationToken cancellationToken) { - foreach (TextProcessingRequest request in texts.Select((string value, int index) => new TextProcessingRequest(Text: value, TaskId: $"Task{index}"))) + foreach (TextProcessingRequest request in texts.Select((value, index) => new TextProcessingRequest(Text: value, TaskId: $"Task{index}"))) { state.PendingTaskIds.Add(request.TaskId); await context.SendMessageAsync(request, cancellationToken: cancellationToken).ConfigureAwait(false); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/09_Subworkflow_ExternalRequest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/09_Subworkflow_ExternalRequest.cs index 9173304a57..56c7f0a157 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/09_Subworkflow_ExternalRequest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/09_Subworkflow_ExternalRequest.cs @@ -79,7 +79,7 @@ public static WorkflowBuilder AddExternalRequest(this Workf public static WorkflowBuilder AddExternalRequest(this WorkflowBuilder builder, ExecutorBinding source, out RequestPort inputPort, string? id = null) { - id = id ?? $"{source.Id}.Requests[{typeof(TRequest).Name}=>{typeof(TResponse).Name}]"; + id ??= $"{source.Id}.Requests[{typeof(TRequest).Name}=>{typeof(TResponse).Name}]"; inputPort = RequestPort.Create(id); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/StateManagerTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/StateManagerTests.cs index 13c21025fa..2d81a2ef53 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/StateManagerTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/StateManagerTests.cs @@ -538,7 +538,7 @@ public async Task Test_LoadPortableValueState_AfterSerializationAsync() Dictionary exportedState = await manager.ExportStateAsync(); Dictionary serializedState = JsonSerializationTests.RunJsonRoundtrip(exportedState); - Checkpoint testCheckpoint = new(0, JsonSerializationTests.CreateTestWorkflowInfo(), new([], [], []), serializedState, new()); + Checkpoint testCheckpoint = new(0, JsonSerializationTests.CreateTestWorkflowInfo(), new([], [], []), serializedState, []); manager = new(); await manager.ImportStateAsync(testCheckpoint); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestEchoAgent.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestEchoAgent.cs index 369f08bd8b..a77fc8a495 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestEchoAgent.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestEchoAgent.cs @@ -18,7 +18,7 @@ internal class TestEchoAgent(string? id = null, string? name = null, string? pre public override AgentThread DeserializeThread(JsonElement serializedThread, JsonSerializerOptions? jsonSerializerOptions = null) { - return JsonSerializer.Deserialize(serializedThread, jsonSerializerOptions) ?? this.GetNewThread(); + return serializedThread.Deserialize(jsonSerializerOptions) ?? this.GetNewThread(); } public override AgentThread GetNewThread() @@ -91,7 +91,5 @@ public override async IAsyncEnumerable RunStreamingAsync } } - private sealed class EchoAgentThread : InMemoryAgentThread - { - } + private sealed class EchoAgentThread : InMemoryAgentThread; } diff --git a/dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistant.IntegrationTests.csproj b/dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistant.IntegrationTests.csproj index 17ca46e4af..b7fa78d499 100644 --- a/dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistant.IntegrationTests.csproj +++ b/dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistant.IntegrationTests.csproj @@ -1,8 +1,6 @@  - $(ProjectsTargetFrameworks) - $(ProjectsDebugTargetFrameworks) True $(NoWarn);OPENAI001; diff --git a/dotnet/tests/OpenAIChatCompletion.IntegrationTests/OpenAIChatCompletion.IntegrationTests.csproj b/dotnet/tests/OpenAIChatCompletion.IntegrationTests/OpenAIChatCompletion.IntegrationTests.csproj index 6d86ae649e..ff68295855 100644 --- a/dotnet/tests/OpenAIChatCompletion.IntegrationTests/OpenAIChatCompletion.IntegrationTests.csproj +++ b/dotnet/tests/OpenAIChatCompletion.IntegrationTests/OpenAIChatCompletion.IntegrationTests.csproj @@ -1,7 +1,6 @@ - $(ProjectsTargetFrameworks) True diff --git a/dotnet/tests/OpenAIResponse.IntegrationTests/OpenAIResponse.IntegrationTests.csproj b/dotnet/tests/OpenAIResponse.IntegrationTests/OpenAIResponse.IntegrationTests.csproj index da5fae35d9..540353d856 100644 --- a/dotnet/tests/OpenAIResponse.IntegrationTests/OpenAIResponse.IntegrationTests.csproj +++ b/dotnet/tests/OpenAIResponse.IntegrationTests/OpenAIResponse.IntegrationTests.csproj @@ -1,7 +1,6 @@ - $(ProjectsTargetFrameworks) True $(NoWarn);OPENAI001;