From 69f906d199cb0662623b58fc0214c2ebadc8d58f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 05:16:30 +0000 Subject: [PATCH 1/4] Initial plan From 5c0a65a3eb912f654400f7212625dab4bc1c8a4c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 05:33:30 +0000 Subject: [PATCH 2/4] Upgrade to .NET 10.0 with updated NuGet packages Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- Directory.Build.props | 4 +++- Directory.Packages.props | 22 +++++++++---------- .../EssentialCSharp.Chat.Common.csproj | 2 +- .../EssentialCSharp.Chat.Tests.csproj | 2 +- .../EssentialCSharp.Chat.csproj | 2 +- .../EssentialCSharp.Web.Tests.csproj | 5 +++-- .../WebApplicationFactory.cs | 21 +++++++++++++----- EssentialCSharp.Web/Dockerfile | 2 +- .../EssentialCSharp.Web.csproj | 4 +++- EssentialCSharp.Web/Program.cs | 2 +- global.json | 2 +- 11 files changed, 42 insertions(+), 26 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 10592d1d..f80856a9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,12 +1,14 @@ enable - 12 + 13 Recommended enable true true Linux + + $(NoWarn);CA1873 True diff --git a/Directory.Packages.props b/Directory.Packages.props index 4777a452..12e2c1f1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -26,22 +26,22 @@ - - - - - - - - - - + + + + + + + + + + - + 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..28a98ad2 100644 --- a/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj +++ b/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj @@ -1,14 +1,15 @@  - net9.0 + net10.0 false false - $(NoWarn);CA1707 + $(NoWarn);CA1707;NU1902;NU1903 diff --git a/EssentialCSharp.Web.Tests/WebApplicationFactory.cs b/EssentialCSharp.Web.Tests/WebApplicationFactory.cs index 8c84b992..2ae60d35 100644 --- a/EssentialCSharp.Web.Tests/WebApplicationFactory.cs +++ b/EssentialCSharp.Web.Tests/WebApplicationFactory.cs @@ -16,22 +16,33 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) { builder.ConfigureServices(services => { - ServiceDescriptor? descriptor = services.SingleOrDefault( - d => d.ServiceType == - typeof(DbContextOptions)); - + // Remove the existing DbContext and related services + var descriptorType = typeof(DbContextOptions); + var descriptor = services.SingleOrDefault(d => d.ServiceType == descriptorType); if (descriptor != null) { services.Remove(descriptor); } + // Remove all DbContextOptions related services to avoid EF Core 10 multiple provider error + var allDbContextOptions = services.Where(d => + d.ServiceType.IsGenericType && + d.ServiceType.Name.Contains("DbContextOptions")).ToList(); + foreach (var desc in allDbContextOptions) + { + services.Remove(desc); + } + _Connection = new SqliteConnection(SqlConnectionString); _Connection.Open(); + // Add SQLite DbContext without using the global service provider services.AddDbContext(options => { options.UseSqlite(_Connection); - }); + // Disable service provider caching to avoid shared state in EF Core 10 + options.EnableServiceProviderCaching(false); + }, ServiceLifetime.Scoped, ServiceLifetime.Scoped); using ServiceProvider serviceProvider = services.BuildServiceProvider(); using IServiceScope scope = serviceProvider.CreateScope(); diff --git a/EssentialCSharp.Web/Dockerfile b/EssentialCSharp.Web/Dockerfile index 39f641ae..7268ae3a 100644 --- a/EssentialCSharp.Web/Dockerfile +++ b/EssentialCSharp.Web/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /app EXPOSE 8080 EXPOSE 8081 -FROM mcr.microsoft.com/dotnet/sdk:9.0.306 AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build ARG ACCESS_TO_NUGET_FEED=true ENV ACCESS_TO_NUGET_FEED=$ACCESS_TO_NUGET_FEED RUN sh -c "$(curl -fsSL https://aka.ms/install-artifacts-credprovider.sh)" diff --git a/EssentialCSharp.Web/EssentialCSharp.Web.csproj b/EssentialCSharp.Web/EssentialCSharp.Web.csproj index cf53c6ff..b4866488 100644 --- a/EssentialCSharp.Web/EssentialCSharp.Web.csproj +++ b/EssentialCSharp.Web/EssentialCSharp.Web.csproj @@ -1,6 +1,8 @@  - net9.0 + net10.0 + + $(NoWarn);NU1902;NU1903 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(); }); diff --git a/global.json b/global.json index e7673427..ba3d1477 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.101", + "version": "10.0.100", "rollForward": "latestMinor" } } \ No newline at end of file From a367dc90e0fa12b3e1e906842c1e5ab82ff58f88 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 23:35:48 +0000 Subject: [PATCH 3/4] Update to C# 14 and move suppressions to Directory.Build.props - Update LangVersion from 13 to 14 - Remove NoWarn suppressions from individual csproj files - Add WarningsNotAsErrors for NU1902, NU1903, CA1873 in Directory.Build.props - This follows Microsoft's recommended approach for projects using TreatWarningsAsErrors Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- Directory.Build.props | 6 +++--- EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj | 3 +-- EssentialCSharp.Web/EssentialCSharp.Web.csproj | 2 -- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index f80856a9..fa57dfa2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,14 +1,14 @@ enable - 13 + 14 Recommended enable true true Linux - - $(NoWarn);CA1873 + + $(WarningsNotAsErrors);NU1902;NU1903;CA1873 True diff --git a/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj b/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj index 28a98ad2..01df7cf7 100644 --- a/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj +++ b/EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj @@ -7,9 +7,8 @@ false - $(NoWarn);CA1707;NU1902;NU1903 + $(NoWarn);CA1707 diff --git a/EssentialCSharp.Web/EssentialCSharp.Web.csproj b/EssentialCSharp.Web/EssentialCSharp.Web.csproj index b4866488..41a72ccc 100644 --- a/EssentialCSharp.Web/EssentialCSharp.Web.csproj +++ b/EssentialCSharp.Web/EssentialCSharp.Web.csproj @@ -1,8 +1,6 @@  net10.0 - - $(NoWarn);NU1902;NU1903 From 0924c9b0b4317f8db5b581a7e8d68edaecb16ba3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 23:53:42 +0000 Subject: [PATCH 4/4] Remove Microsoft.VisualStudio.Web.CodeGeneration.Design package - Removed CodeGeneration.Design package from Directory.Packages.props and EssentialCSharp.Web.csproj - Package was only used for scaffolding and is not needed at runtime - Reduces some transitive vulnerability warnings - Note: NU1902/NU1903 warnings still remain from Microsoft.AspNetCore.Mvc.Testing 10.0.0 transitive dependencies (Microsoft issue) Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- Directory.Build.props | 4 ++-- Directory.Packages.props | 1 - EssentialCSharp.Web/EssentialCSharp.Web.csproj | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index fa57dfa2..7a120e08 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,8 +7,8 @@ true true Linux - - $(WarningsNotAsErrors);NU1902;NU1903;CA1873 + + $(WarningsNotAsErrors);CA1873;NU1902;NU1903 True diff --git a/Directory.Packages.props b/Directory.Packages.props index 12e2c1f1..82921b61 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -41,7 +41,6 @@ - diff --git a/EssentialCSharp.Web/EssentialCSharp.Web.csproj b/EssentialCSharp.Web/EssentialCSharp.Web.csproj index 41a72ccc..c0ee2712 100644 --- a/EssentialCSharp.Web/EssentialCSharp.Web.csproj +++ b/EssentialCSharp.Web/EssentialCSharp.Web.csproj @@ -30,7 +30,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive -