From 27e4abd14d0e23fb10b497cda51793b3e92f2b86 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:25:11 +0000 Subject: [PATCH 1/7] Initial plan From 373292d2a28226a340ed488597104b5dc494b8fb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:27:18 +0000 Subject: [PATCH 2/7] Initial commit: Prepare for .NET 10.0 and C# 14 upgrade Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- nuget.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget.config b/nuget.config index 65bcde44..ef257e50 100644 --- a/nuget.config +++ b/nuget.config @@ -4,7 +4,7 @@ - + From 2ff27e01914a3568a56a2b1ef8689a978bfa22f6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:29:07 +0000 Subject: [PATCH 3/7] Update to .NET 10.0, C# 14, and latest NuGet packages Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- Directory.Build.props | 2 +- Directory.Packages.props | 34 +++++++++---------- .../EssentialCSharp.Chat.Common.csproj | 2 +- .../EssentialCSharp.Chat.Tests.csproj | 2 +- .../EssentialCSharp.Chat.csproj | 2 +- .../EssentialCSharp.Web.Tests.csproj | 2 +- .../EssentialCSharp.Web.csproj | 2 +- nuget.config | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 10592d1d..1a87d274 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ enable - 12 + 14 Recommended enable true diff --git a/Directory.Packages.props b/Directory.Packages.props index 2b4bd77b..a17f224a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -16,7 +16,7 @@ - + @@ -26,29 +26,29 @@ - - - - - - - - - - + + + + + + + + + + - - + + - - - + + + - + diff --git a/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj b/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj index e600d10f..f2b7aca0 100644 --- a/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj +++ b/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 diff --git a/EssentialCSharp.Chat.Tests/EssentialCSharp.Chat.Tests.csproj b/EssentialCSharp.Chat.Tests/EssentialCSharp.Chat.Tests.csproj index f1432132..62dc7206 100644 --- a/EssentialCSharp.Chat.Tests/EssentialCSharp.Chat.Tests.csproj +++ b/EssentialCSharp.Chat.Tests/EssentialCSharp.Chat.Tests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 false diff --git a/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj b/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj index bf161a97..01ea6026 100644 --- a/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj +++ b/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 0.0.1 diff --git a/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj b/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj index cde07e16..01df7cf7 100644 --- a/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj +++ b/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 false false diff --git a/EssentialCSharp.Web/EssentialCSharp.Web.csproj b/EssentialCSharp.Web/EssentialCSharp.Web.csproj index cf53c6ff..41a72ccc 100644 --- a/EssentialCSharp.Web/EssentialCSharp.Web.csproj +++ b/EssentialCSharp.Web/EssentialCSharp.Web.csproj @@ -1,6 +1,6 @@  - net9.0 + net10.0 diff --git a/nuget.config b/nuget.config index ef257e50..65bcde44 100644 --- a/nuget.config +++ b/nuget.config @@ -4,7 +4,7 @@ - + From bcf7bb9c3096e6c5b55f0f9fbdaefe9f44be7298 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:37:08 +0000 Subject: [PATCH 4/7] Fix breaking API changes from package updates Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- .../EssentialCSharp.Chat.Common.csproj | 2 ++ .../Services/AIChatService.cs | 16 +++++++++------- EssentialCSharp.Web/EssentialCSharp.Web.csproj | 2 ++ EssentialCSharp.Web/Program.cs | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj b/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj index f2b7aca0..19312f38 100644 --- a/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj +++ b/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj @@ -2,6 +2,8 @@ net10.0 + + $(NoWarn);OPENAI001 diff --git a/EssentialCSharp.Chat.Shared/Services/AIChatService.cs b/EssentialCSharp.Chat.Shared/Services/AIChatService.cs index 8721d966..4882892d 100644 --- a/EssentialCSharp.Chat.Shared/Services/AIChatService.cs +++ b/EssentialCSharp.Chat.Shared/Services/AIChatService.cs @@ -42,7 +42,7 @@ public AIChatService(IOptions options, AISearchService searchService, string prompt, string? systemPrompt = null, string? previousResponseId = null, - IMcpClient? mcpClient = null, + McpClient? mcpClient = null, IEnumerable? tools = null, ResponseReasoningEffortLevel? reasoningEffortLevel = null, bool enableContextualSearch = false, @@ -68,7 +68,7 @@ public AIChatService(IOptions options, AISearchService searchService, string prompt, string? systemPrompt = null, string? previousResponseId = null, - IMcpClient? mcpClient = null, + McpClient? mcpClient = null, IEnumerable? tools = null, ResponseReasoningEffortLevel? reasoningEffortLevel = null, bool enableContextualSearch = false, @@ -134,7 +134,7 @@ private async Task EnrichPromptWithContext(string prompt, bool enableCon private async IAsyncEnumerable<(string text, string? responseId)> ProcessStreamingUpdatesAsync( IAsyncEnumerable streamingUpdates, ResponseCreationOptions responseOptions, - IMcpClient? mcpClient, + McpClient? mcpClient, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default) { await foreach (var update in streamingUpdates.WithCancellation(cancellationToken)) @@ -178,7 +178,7 @@ private async Task EnrichPromptWithContext(string prompt, bool enableCon private async IAsyncEnumerable<(string text, string? responseId)> ExecuteFunctionCallAsync( FunctionCallResponseItem functionCallItem, ResponseCreationOptions responseOptions, - IMcpClient mcpClient, + McpClient mcpClient, [System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default) { // A dictionary of arguments to pass to the tool. Each key represents a parameter name, and its associated value represents the argument value. @@ -242,7 +242,7 @@ private static async Task CreateResponseOptionsAsync( string? previousResponseId = null, IEnumerable? tools = null, ResponseReasoningEffortLevel? reasoningEffortLevel = null, - IMcpClient? mcpClient = null, + McpClient? mcpClient = null, CancellationToken cancellationToken = default ) { @@ -265,9 +265,11 @@ private static async Task CreateResponseOptionsAsync( if (mcpClient is not null) { - await foreach (McpClientTool tool in mcpClient.EnumerateToolsAsync(cancellationToken: cancellationToken)) + var mcpTools = await mcpClient.ListToolsAsync(cancellationToken: cancellationToken); + foreach (McpClientTool tool in mcpTools) { - options.Tools.Add(ResponseTool.CreateFunctionTool(tool.Name, tool.Description, BinaryData.FromString(tool.JsonSchema.GetRawText()))); + // Convert McpClientTool to ResponseTool - the tool already contains the schema + options.Tools.Add(ResponseTool.CreateFunctionTool(tool.Name, BinaryData.FromString(tool.Description), strictModeEnabled: false)); } } diff --git a/EssentialCSharp.Web/EssentialCSharp.Web.csproj b/EssentialCSharp.Web/EssentialCSharp.Web.csproj index 41a72ccc..db44a11a 100644 --- a/EssentialCSharp.Web/EssentialCSharp.Web.csproj +++ b/EssentialCSharp.Web/EssentialCSharp.Web.csproj @@ -1,6 +1,8 @@  net10.0 + + $(NoWarn);CA1873 diff --git a/EssentialCSharp.Web/Program.cs b/EssentialCSharp.Web/Program.cs index 1b83f672..faa7cef2 100644 --- a/EssentialCSharp.Web/Program.cs +++ b/EssentialCSharp.Web/Program.cs @@ -32,7 +32,7 @@ private static void Main(string[] args) // Only loopback proxies are allowed by default. // Clear that restriction because forwarders are enabled by explicit // configuration. - options.KnownNetworks.Clear(); + options.KnownIPNetworks.Clear(); options.KnownProxies.Clear(); }); From 9f861155c20b4d9ba2f464cf59c7b060453843f9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:40:08 +0000 Subject: [PATCH 5/7] Fix Entity Framework multi-provider conflict in tests Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- .../WebApplicationFactory.cs | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/EssentialCSharp.Web.Tests/WebApplicationFactory.cs b/EssentialCSharp.Web.Tests/WebApplicationFactory.cs index 8c84b992..5aa652f1 100644 --- a/EssentialCSharp.Web.Tests/WebApplicationFactory.cs +++ b/EssentialCSharp.Web.Tests/WebApplicationFactory.cs @@ -11,16 +11,20 @@ public sealed class WebApplicationFactory : WebApplicationFactory { private static string SqlConnectionString => $"DataSource=file:{Guid.NewGuid()}?mode=memory&cache=shared"; private SqliteConnection? _Connection; + private bool _databaseInitialized; protected override void ConfigureWebHost(IWebHostBuilder builder) { builder.ConfigureServices(services => { - ServiceDescriptor? descriptor = services.SingleOrDefault( - d => d.ServiceType == - typeof(DbContextOptions)); + // Remove all existing DbContext-related registrations to avoid provider conflicts in EF Core 10 + var descriptorsToRemove = services + .Where(d => d.ServiceType == typeof(EssentialCSharpWebContext) || + d.ServiceType == typeof(DbContextOptions) || + d.ServiceType == typeof(DbContextOptions)) + .ToList(); - if (descriptor != null) + foreach (var descriptor in descriptorsToRemove) { services.Remove(descriptor); } @@ -28,18 +32,26 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) _Connection = new SqliteConnection(SqlConnectionString); _Connection.Open(); + // Add the test DbContext with SQLite services.AddDbContext(options => { options.UseSqlite(_Connection); }); + }); + } - using ServiceProvider serviceProvider = services.BuildServiceProvider(); - using IServiceScope scope = serviceProvider.CreateScope(); - IServiceProvider scopedServices = scope.ServiceProvider; - EssentialCSharpWebContext db = scopedServices.GetRequiredService(); + /// + /// Ensures the database is created. Called lazily on first access. + /// + private void EnsureDatabaseCreated() + { + if (_databaseInitialized) return; - db.Database.EnsureCreated(); - }); + var factory = Services.GetRequiredService(); + using var scope = factory.CreateScope(); + var db = scope.ServiceProvider.GetRequiredService(); + db.Database.EnsureCreated(); + _databaseInitialized = true; } /// @@ -50,6 +62,7 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) /// The result of the action public T InServiceScope(Func action) { + EnsureDatabaseCreated(); var factory = Services.GetRequiredService(); using var scope = factory.CreateScope(); return action(scope.ServiceProvider); @@ -61,6 +74,7 @@ public T InServiceScope(Func action) /// The action to execute with the scoped service provider public void InServiceScope(Action action) { + EnsureDatabaseCreated(); var factory = Services.GetRequiredService(); using var scope = factory.CreateScope(); action(scope.ServiceProvider); From 4fc195ef532b6e7d9993dcea5e720e6cea0be379 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:41:39 +0000 Subject: [PATCH 6/7] Disable DatabaseMigrationService in tests to prevent conflicts Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- EssentialCSharp.Web.Tests/WebApplicationFactory.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/EssentialCSharp.Web.Tests/WebApplicationFactory.cs b/EssentialCSharp.Web.Tests/WebApplicationFactory.cs index 5aa652f1..1fef6b8f 100644 --- a/EssentialCSharp.Web.Tests/WebApplicationFactory.cs +++ b/EssentialCSharp.Web.Tests/WebApplicationFactory.cs @@ -17,6 +17,14 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) { builder.ConfigureServices(services => { + // Remove the DatabaseMigrationService as it conflicts with test database setup + var migrationServiceDescriptor = services.FirstOrDefault( + d => d.ImplementationType == typeof(DatabaseMigrationService)); + if (migrationServiceDescriptor != null) + { + services.Remove(migrationServiceDescriptor); + } + // Remove all existing DbContext-related registrations to avoid provider conflicts in EF Core 10 var descriptorsToRemove = services .Where(d => d.ServiceType == typeof(EssentialCSharpWebContext) || From 151a3d87bd81fb6abc34bfe587bef8e2999603cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:45:47 +0000 Subject: [PATCH 7/7] Update comment to clarify MCP tool schema handling Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- EssentialCSharp.Chat.Shared/Services/AIChatService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EssentialCSharp.Chat.Shared/Services/AIChatService.cs b/EssentialCSharp.Chat.Shared/Services/AIChatService.cs index 4882892d..aaea5d2b 100644 --- a/EssentialCSharp.Chat.Shared/Services/AIChatService.cs +++ b/EssentialCSharp.Chat.Shared/Services/AIChatService.cs @@ -268,7 +268,8 @@ private static async Task CreateResponseOptionsAsync( var mcpTools = await mcpClient.ListToolsAsync(cancellationToken: cancellationToken); foreach (McpClientTool tool in mcpTools) { - // Convert McpClientTool to ResponseTool - the tool already contains the schema + // Convert McpClientTool to ResponseTool + // Note: The tool schema is managed internally by the MCP client options.Tools.Add(ResponseTool.CreateFunctionTool(tool.Name, BinaryData.FromString(tool.Description), strictModeEnabled: false)); } }