Browse Source

Update some CSharp frameworks to latest (#10184)

Andreas Nägeli 1 month ago
parent
commit
fced31e613

+ 13 - 13
frameworks/CSharp/embedio/Benchmarks/Benchmarks.csproj

@@ -1,23 +1,23 @@
 <Project Sdk="Microsoft.NET.Sdk">
-  
+
   <PropertyGroup>
-    
-    <TargetFramework>net5.0</TargetFramework>
-    <LangVersion>9.0</LangVersion>
-    
+
+    <TargetFramework>net9.0</TargetFramework>
+    <LangVersion>13.0</LangVersion>
+
     <AssemblyTitle>EmbedIO Benchmarks</AssemblyTitle>
     <Description>Test suite to be executed with TechEmpower FrameworkBenchmarks.</Description>
-    
-    <StartupObject>Benchmarks.Program</StartupObject>    
+
+    <StartupObject>Benchmarks.Program</StartupObject>
     <OutputType>Exe</OutputType>
-    
+
     <ServerGarbageCollection>true</ServerGarbageCollection>
     <TieredCompilation>false</TieredCompilation>
-    
+
   </PropertyGroup>
-  
+
   <ItemGroup>
-    <PackageReference Include="EmbedIO" Version="3.4.3" />
+    <PackageReference Include="EmbedIO" Version="3.5.2" />
   </ItemGroup>
-  
-</Project>
+
+</Project>

+ 8 - 6
frameworks/CSharp/embedio/Benchmarks/Program.cs

@@ -1,10 +1,12 @@
-using EmbedIO;
-using Swan.Logging;
-using System;
+using System;
 using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 
+using EmbedIO;
+
+using Swan.Logging;
+
 namespace Benchmarks
 {
 
@@ -21,7 +23,7 @@ namespace Benchmarks
 
     public static class Program
     {
-        private static readonly ManualResetEvent _WaitEvent = new ManualResetEvent(false);
+        private static readonly ManualResetEvent WaitEvent = new(false);
 
         public static async Task<int> Main(string[] args)
         {
@@ -60,12 +62,12 @@ namespace Benchmarks
             {
                 AppDomain.CurrentDomain.ProcessExit += (_, __) =>
                 {
-                    _WaitEvent.Set();
+                    WaitEvent.Set();
                 };
 
                 await server.RunAsync();
 
-                _WaitEvent.WaitOne();
+                WaitEvent.WaitOne();
 
                 return 0;
             }

+ 3 - 3
frameworks/CSharp/embedio/README.md

@@ -6,17 +6,17 @@ See the [project website](https://github.com/unosquare/embedio) for more informa
 
 **Language**
 
-* C# 9.0
+* C# 13.0
 
 **Platforms**
 
-* .NET 5
+* .NET 9
 
 **Web Servers**
 
 * [EmbedIO](https://github.com/unosquare/embedio)
 
-## Paths & Source for Tests
+## Paths \& Source for Tests
 
 * [Plaintext](Benchmarks/Program.cs): "/plaintext"
 * [JSON](Benchmarks/Program.cs): "/json"

+ 3 - 3
frameworks/CSharp/embedio/embedio.dockerfile

@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS build
+FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
 WORKDIR /source
 
 # copy csproj and restore as distinct layers
@@ -7,10 +7,10 @@ RUN dotnet restore -r linux-musl-x64
 
 # copy and publish app and libraries
 COPY Benchmarks/ .
-RUN dotnet publish -c release -o /app -r linux-musl-x64
+RUN dotnet publish -c release -o /app -r linux-musl-x64 --no-restore --self-contained
 
 # final stage/image
-FROM mcr.microsoft.com/dotnet/runtime-deps:5.0-alpine
+FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine
 WORKDIR /app
 COPY --from=build /app .
 

+ 4 - 4
frameworks/CSharp/genhttp/Benchmarks/Benchmarks.csproj

@@ -26,11 +26,11 @@
 
     <ItemGroup>
 
-        <PackageReference Include="GenHTTP.Core" Version="9.6.2" />
-        <PackageReference Include="GenHTTP.Modules.Webservices" Version="9.6.2" />
+        <PackageReference Include="GenHTTP.Core" Version="9.8.0" />
+        <PackageReference Include="GenHTTP.Modules.Webservices" Version="9.8.0" />
 
-        <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
-        <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
+        <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" />
+        <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
 
     </ItemGroup>
 

+ 14 - 14
frameworks/CSharp/netcoreserver/Benchmarks/Benchmarks.csproj

@@ -1,24 +1,24 @@
 <Project Sdk="Microsoft.NET.Sdk">
-  
+
   <PropertyGroup>
-    
-    <TargetFramework>net5.0</TargetFramework>
-    <LangVersion>9.0</LangVersion>
-    
+
+    <TargetFramework>net9.0</TargetFramework>
+    <LangVersion>13.0</LangVersion>
+
     <AssemblyTitle>EmbedIO Benchmarks</AssemblyTitle>
     <Description>Test suite to be executed with TechEmpower FrameworkBenchmarks.</Description>
-    
-    <StartupObject>Benchmarks.Program</StartupObject>    
+
+    <StartupObject>Benchmarks.Program</StartupObject>
     <OutputType>Exe</OutputType>
-    
+
     <ServerGarbageCollection>true</ServerGarbageCollection>
     <TieredCompilation>false</TieredCompilation>
-    
+
   </PropertyGroup>
-  
+
   <ItemGroup>
-    <PackageReference Include="NetCoreServer" Version="5.0.7" />
-    <PackageReference Include="System.Text.Json" Version="5.0.0" />
+    <PackageReference Include="NetCoreServer" Version="8.0.7" />
+    <PackageReference Include="System.Text.Json" Version="9.0.10" />
   </ItemGroup>
-  
-</Project>
+
+</Project>

+ 1 - 1
frameworks/CSharp/netcoreserver/Benchmarks/HttpBenchmarkSession.cs

@@ -27,7 +27,7 @@ namespace Benchmarks
             }
             else
             {
-                SendResponseAsync(Response.MakeErrorResponse("Not found", 404));
+                SendResponseAsync(Response.MakeErrorResponse(404, "Not found"));
             }
         }
 

+ 3 - 3
frameworks/CSharp/netcoreserver/Benchmarks/Program.cs

@@ -8,7 +8,7 @@ namespace Benchmarks
     public static class Program
     {
 
-        private static readonly ManualResetEvent _WaitEvent = new ManualResetEvent(false);
+        private static readonly ManualResetEvent WaitEvent = new(false);
 
         public static int Main(string[] args)
         {
@@ -18,12 +18,12 @@ namespace Benchmarks
             {
                 AppDomain.CurrentDomain.ProcessExit += (_, __) =>
                 {
-                    _WaitEvent.Set();
+                    WaitEvent.Set();
                 };
 
                 server.Start();
 
-                _WaitEvent.WaitOne();
+                WaitEvent.WaitOne();
 
                 return 0;
             }

+ 3 - 3
frameworks/CSharp/netcoreserver/README.md

@@ -6,17 +6,17 @@ See the [project website](https://github.com/chronoxor/NetCoreServer) for more i
 
 **Language**
 
-* C# 9.0
+* C# 13.0
 
 **Platforms**
 
-* .NET 5
+* .NET 9
 
 **Web Servers**
 
 * [NetCoreServer](https://github.com/chronoxor/NetCoreServer)
 
-## Paths & Source for Tests
+## Paths \& Source for Tests
 
 * [Plaintext](Benchmarks/HttpBenchmarkSession.cs): "/plaintext"
 * [JSON](Benchmarks/HttpBenchmarkSession.cs): "/json"

+ 3 - 3
frameworks/CSharp/netcoreserver/netcoreserver.dockerfile

@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS build
+FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
 WORKDIR /source
 
 # copy csproj and restore as distinct layers
@@ -7,10 +7,10 @@ RUN dotnet restore -r linux-musl-x64
 
 # copy and publish app and libraries
 COPY Benchmarks/ .
-RUN dotnet publish -c release -o /app -r linux-musl-x64
+RUN dotnet publish -c release -o /app -r linux-musl-x64 --no-restore --self-contained
 
 # final stage/image
-FROM mcr.microsoft.com/dotnet/runtime-deps:5.0-alpine
+FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine
 WORKDIR /app
 COPY --from=build /app .