From fbb31df7b10264e63a5750a9608472cc7bc627b1 Mon Sep 17 00:00:00 2001 From: Zoltan Csizmadia Date: Fri, 25 Sep 2026 09:03:20 -0500 Subject: [PATCH] AVRO-4352: [C#] Add .NET 9.0 and .NET 10.0 support Target net8.0, net9.0 and net10.0 for executables and unit tests, replacing the end-of-life net6.0 and net7.0. Class libraries keep targeting netstandard2.0 and netstandard2.1. Install the 8.0, 9.0 and 10.0 SDKs in the C#, CodeQL and Java interop workflows and in the build Docker image, run perf and interop data generation on net10.0, and update the README target framework table. --- .github/workflows/codeql-csharp-analysis.yml | 4 ++-- .github/workflows/test-lang-csharp.yml | 8 ++++---- .github/workflows/test-lang-java.yml | 4 ++-- lang/csharp/README.md | 4 ++-- lang/csharp/build.sh | 4 ++-- lang/csharp/common.props | 2 +- lang/csharp/src/apache/benchmark/Program.cs | 4 ++-- share/docker/Dockerfile | 6 +++--- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/codeql-csharp-analysis.yml b/.github/workflows/codeql-csharp-analysis.yml index 6e93ae649f5..9bc1cac4070 100644 --- a/.github/workflows/codeql-csharp-analysis.yml +++ b/.github/workflows/codeql-csharp-analysis.yml @@ -64,9 +64,9 @@ jobs: uses: actions/setup-dotnet@v6 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x + 10.0.x # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/test-lang-csharp.yml b/.github/workflows/test-lang-csharp.yml index a513620d4df..c7f25449371 100644 --- a/.github/workflows/test-lang-csharp.yml +++ b/.github/workflows/test-lang-csharp.yml @@ -51,9 +51,9 @@ jobs: uses: actions/setup-dotnet@v6 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x + 10.0.x - uses: actions/cache@v6 with: @@ -86,9 +86,9 @@ jobs: uses: actions/setup-dotnet@v6 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x + 10.0.x - name: Cache Local Maven Repository uses: actions/cache@v6 diff --git a/.github/workflows/test-lang-java.yml b/.github/workflows/test-lang-java.yml index 0fdf0b9fb86..ea541b0c1ff 100644 --- a/.github/workflows/test-lang-java.yml +++ b/.github/workflows/test-lang-java.yml @@ -144,9 +144,9 @@ jobs: uses: actions/setup-dotnet@v6 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x + 10.0.x - name: "Create Interop Data Directory" working-directory: . diff --git a/lang/csharp/README.md b/lang/csharp/README.md index 6a7c7283b21..a36446f2f64 100644 --- a/lang/csharp/README.md +++ b/lang/csharp/README.md @@ -12,12 +12,12 @@ Install-Package Apache.Avro ## Build & Test -1. Install [.NET SDK 8.0+](https://dotnet.microsoft.com/download/dotnet-core) +1. Install [.NET SDK 10.0+](https://dotnet.microsoft.com/download/dotnet-core) 2. `dotnet test` ## Project Target Frameworks -| Project | Published to nuget.org | Type | .NET Standard 2.0 | .NET Standard 2.1 | .NET 6.0 | .NET 7.0 | .NET 8.0 | +| Project | Published to nuget.org | Type | .NET Standard 2.0 | .NET Standard 2.1 | .NET 8.0 | .NET 9.0 | .NET 10.0 | |:-------------------:|:--------------------------:|:----------:|:------------------:|:-----------------:|:---------:|:---------:|:---------:| | Avro.main | Apache.Avro | Library | ✔️ | ✔️ | | | | | Avro.File.Snappy | Apache.Avro.File.Snappy | Library | ✔️ | ✔️ | | | | diff --git a/lang/csharp/build.sh b/lang/csharp/build.sh index 2efd4463174..b34883e0501 100755 --- a/lang/csharp/build.sh +++ b/lang/csharp/build.sh @@ -42,7 +42,7 @@ do perf) pushd ./src/apache/perf/ - dotnet run --configuration Release --framework net8.0 + dotnet run --configuration Release --framework net10.0 ;; dist) @@ -77,7 +77,7 @@ do ;; interop-data-generate) - dotnet run --project src/apache/test/Avro.test.csproj --framework net8.0 ../../share/test/schemas/interop.avsc ../../build/interop/data + dotnet run --project src/apache/test/Avro.test.csproj --framework net10.0 ../../share/test/schemas/interop.avsc ../../build/interop/data ;; interop-data-test) diff --git a/lang/csharp/common.props b/lang/csharp/common.props index f41617eadfa..36b04db1702 100644 --- a/lang/csharp/common.props +++ b/lang/csharp/common.props @@ -37,7 +37,7 @@ - net6.0;net7.0;net8.0 + net8.0;net9.0;net10.0 netstandard2.0;netstandard2.1 diff --git a/lang/csharp/src/apache/benchmark/Program.cs b/lang/csharp/src/apache/benchmark/Program.cs index c29d51f94db..235127cb226 100644 --- a/lang/csharp/src/apache/benchmark/Program.cs +++ b/lang/csharp/src/apache/benchmark/Program.cs @@ -21,8 +21,8 @@ namespace Avro.Benchmark { public class Program { - // dotnet run -c Release -f net8.0 - // dotnet run -c Release -f net8.0 --runtimes net6.0 net7.0 net8.0 + // dotnet run -c Release -f net10.0 + // dotnet run -c Release -f net10.0 --runtimes net8.0 net9.0 net10.0 public static void Main(string[] args) { BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); diff --git a/share/docker/Dockerfile b/share/docker/Dockerfile index 5932e5be7b1..2838278c223 100644 --- a/share/docker/Dockerfile +++ b/share/docker/Dockerfile @@ -211,9 +211,9 @@ ENV PATH=$PATH:/root/.cargo/bin/:/root/.local/bin # Install .NET SDK RUN cd /opt ; \ wget https://dot.net/v1/dotnet-install.sh ; \ - bash ./dotnet-install.sh --channel "6.0" --install-dir "/opt/dotnet" ; \ - bash ./dotnet-install.sh --channel "7.0" --install-dir "/opt/dotnet" ; \ - bash ./dotnet-install.sh --channel "8.0" --install-dir "/opt/dotnet" ; + bash ./dotnet-install.sh --channel "8.0" --install-dir "/opt/dotnet" ; \ + bash ./dotnet-install.sh --channel "9.0" --install-dir "/opt/dotnet" ; \ + bash ./dotnet-install.sh --channel "10.0" --install-dir "/opt/dotnet" ; ENV PATH=$PATH:/opt/dotnet