From b053713730f1643441699cbd09e6eca15c61f7ff Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 15 Nov 2023 09:48:29 -0800 Subject: [PATCH 1/5] Do not target .NET 5.0 --- .github/workflows/test.yml | 19 ++++++------------- .../MaxMind.Db.Benchmark.csproj | 4 ++-- MaxMind.Db.Test/MaxMind.Db.Test.csproj | 4 ++-- MaxMind.Db/MaxMind.Db.csproj | 2 +- releasenotes.md | 6 ++++++ 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f0e2fc..50bb9fb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,20 +17,13 @@ jobs: with: submodules: true - - name: Setup dotnet 3.1 + - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 3.1 - - - name: Setup .NET 5.0 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 5.0.* - - - name: Setup .NET 6.0 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.* + dotnet-version: | + 3.1.x + 6.0.x + 8.0.x - name: Build run: | @@ -39,7 +32,7 @@ jobs: dotnet build MaxMind.Db.Test - name: Run benchmark - run: dotnet run -f netcoreapp3.1 -p MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj + run: dotnet run -f net6.0 --project MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj env: MAXMIND_BENCHMARK_DB: ${{ github.workspace }}/MaxMind.Db.Test/TestData/MaxMind-DB/test-data/GeoIP2-City-Test.mmdb diff --git a/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj b/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj index 71f0b61..01ffdac 100644 --- a/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj +++ b/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj @@ -3,8 +3,8 @@ Benchmark project to validate .NET reader for the MaxMind DB file format 4.0.0 - net6.0;net5.0;net472;netcoreapp3.1 - net6.0;net5.0;netcoreapp3.1 + net6.0;net472 + net6.0 MaxMind.Db.Benchmark Exe MaxMind.Db.Benchmark diff --git a/MaxMind.Db.Test/MaxMind.Db.Test.csproj b/MaxMind.Db.Test/MaxMind.Db.Test.csproj index 162cd9d..c1e84c9 100644 --- a/MaxMind.Db.Test/MaxMind.Db.Test.csproj +++ b/MaxMind.Db.Test/MaxMind.Db.Test.csproj @@ -3,8 +3,8 @@ Test project to validate .NET reader for the MaxMind DB file format 4.0.0 - net6.0;net5.0;net472;netcoreapp3.1 - net6.0;net5.0;netcoreapp3.1 + net6.0;net472 + net6.0 MaxMind.Db.Test ../MaxMind.snk true diff --git a/MaxMind.Db/MaxMind.Db.csproj b/MaxMind.Db/MaxMind.Db.csproj index 61d90cd..eba169f 100644 --- a/MaxMind.Db/MaxMind.Db.csproj +++ b/MaxMind.Db/MaxMind.Db.csproj @@ -3,7 +3,7 @@ .NET reader for the MaxMind DB file format 4.0.0 - net6.0;net5.0;netstandard2.1;netstandard2.0 + net6.0;netstandard2.1;netstandard2.0 true MaxMind.Db ../MaxMind.snk diff --git a/releasenotes.md b/releasenotes.md index acd7c7c..3383f6d 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,5 +1,11 @@ # Release Notes # +## 4.1.0 + +* .NET 5.0 has been removed as a target as it has reach its end of life. + However, if you are using .NET 5.0, the .NET Standard 2.1 target should + continue working for you. + ## 4.0.0 (2022-02-03) ## * This library no longer targets .NET 4.6.1. From 8f79bc2c357b5a3b1cc273d11f640d6502d797be Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 15 Nov 2023 09:51:32 -0800 Subject: [PATCH 2/5] Remove .ConfigureAwait(false) in tests As suggested by analysis warnings --- MaxMind.Db.Test/ReaderTest.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MaxMind.Db.Test/ReaderTest.cs b/MaxMind.Db.Test/ReaderTest.cs index e5dfe78..dc89d81 100644 --- a/MaxMind.Db.Test/ReaderTest.cs +++ b/MaxMind.Db.Test/ReaderTest.cs @@ -57,7 +57,7 @@ public async Task TestAsync() { var file = Path.Combine(_testDataRoot, "MaxMind-DB-test-ipv" + ipVersion + "-" + recordSize + ".mmdb"); - var reader = await Reader.CreateAsync(file).ConfigureAwait(false); + var reader = await Reader.CreateAsync(file); using (reader) { TestMetadata(reader, ipVersion); @@ -110,7 +110,7 @@ public async Task TestStreamAsync() var file = Path.Combine(_testDataRoot, "MaxMind-DB-test-ipv" + ipVersion + "-" + recordSize + ".mmdb"); using var streamReader = File.OpenText(file); - using var reader = await Reader.CreateAsync(streamReader.BaseStream).ConfigureAwait(false); + using var reader = await Reader.CreateAsync(streamReader.BaseStream); TestMetadata(reader, ipVersion); if (ipVersion == 4) @@ -162,7 +162,7 @@ public async Task TestNonSeekableStreamAsync() "MaxMind-DB-test-ipv" + ipVersion + "-" + recordSize + ".mmdb"); using var stream = new NonSeekableStreamWrapper(File.OpenRead(file)); - using var reader = await Reader.CreateAsync(stream).ConfigureAwait(false); + using var reader = await Reader.CreateAsync(stream); TestMetadata(reader, ipVersion); if (ipVersion == 4) @@ -192,7 +192,7 @@ public void NullStreamThrowsArgumentNullException() public void NullStreamThrowsArgumentNullExceptionAsync() { #pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type. - ((Func)(async () => await Reader.CreateAsync((Stream)null).ConfigureAwait(false))) + ((Func)(async () => await Reader.CreateAsync((Stream)null))) #pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type. .Should().ThrowExactlyAsync() .WithMessage("The database stream must not be null.*"); @@ -212,7 +212,7 @@ public void TestEmptyStream() public void TestEmptyStreamAsync() { using var stream = new MemoryStream(); - ((Func)(async () => await Reader.CreateAsync(stream).ConfigureAwait(false))) + ((Func)(async () => await Reader.CreateAsync(stream))) .Should().ThrowExactlyAsync() .WithMessage("*zero bytes left in the stream*"); } From 738b190d968b55ccac9b79de09d8297ef84696a0 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 15 Nov 2023 10:18:44 -0800 Subject: [PATCH 3/5] Add NET 8.0 and NET 7.0 targets --- .github/workflows/codeql-analysis.yml | 8 ++++++-- .github/workflows/test.yml | 3 ++- MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj | 4 ++-- MaxMind.Db.Test/MaxMind.Db.Test.csproj | 4 ++-- MaxMind.Db/MaxMind.Db.csproj | 2 +- releasenotes.md | 1 + 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 55df644..4ff6281 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -26,10 +26,14 @@ jobs: - run: git checkout HEAD^2 if: ${{ github.event_name == 'pull_request' }} - - name: Setup .NET 6.0 + - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.* + dotnet-version: | + 3.1.x + 6.0.x + 7.0.x + 8.0.x # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 50bb9fb..afda726 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,6 +23,7 @@ jobs: dotnet-version: | 3.1.x 6.0.x + 7.0.x 8.0.x - name: Build @@ -32,7 +33,7 @@ jobs: dotnet build MaxMind.Db.Test - name: Run benchmark - run: dotnet run -f net6.0 --project MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj + run: dotnet run -f net8.0 --project MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj env: MAXMIND_BENCHMARK_DB: ${{ github.workspace }}/MaxMind.Db.Test/TestData/MaxMind-DB/test-data/GeoIP2-City-Test.mmdb diff --git a/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj b/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj index 01ffdac..d909c0f 100644 --- a/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj +++ b/MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj @@ -3,8 +3,8 @@ Benchmark project to validate .NET reader for the MaxMind DB file format 4.0.0 - net6.0;net472 - net6.0 + net8.0;net7.0;net6.0;net472 + net8.0;net7.0;net6.0 MaxMind.Db.Benchmark Exe MaxMind.Db.Benchmark diff --git a/MaxMind.Db.Test/MaxMind.Db.Test.csproj b/MaxMind.Db.Test/MaxMind.Db.Test.csproj index c1e84c9..b3858f7 100644 --- a/MaxMind.Db.Test/MaxMind.Db.Test.csproj +++ b/MaxMind.Db.Test/MaxMind.Db.Test.csproj @@ -3,8 +3,8 @@ Test project to validate .NET reader for the MaxMind DB file format 4.0.0 - net6.0;net472 - net6.0 + net8.0;net7.0;net6.0;net472 + net8.0;net7.0;net6.0 MaxMind.Db.Test ../MaxMind.snk true diff --git a/MaxMind.Db/MaxMind.Db.csproj b/MaxMind.Db/MaxMind.Db.csproj index eba169f..721aa9d 100644 --- a/MaxMind.Db/MaxMind.Db.csproj +++ b/MaxMind.Db/MaxMind.Db.csproj @@ -3,7 +3,7 @@ .NET reader for the MaxMind DB file format 4.0.0 - net6.0;netstandard2.1;netstandard2.0 + net8.0;net7.0;net6.0;netstandard2.1;netstandard2.0 true MaxMind.Db ../MaxMind.snk diff --git a/releasenotes.md b/releasenotes.md index 3383f6d..2435eb0 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -5,6 +5,7 @@ * .NET 5.0 has been removed as a target as it has reach its end of life. However, if you are using .NET 5.0, the .NET Standard 2.1 target should continue working for you. +* .NET 7.0 and .NET 8.0 have been added as a target. ## 4.0.0 (2022-02-03) ## From 03cf46dc84e8a514537c34f08da869cd184be70a Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 15 Nov 2023 10:28:55 -0800 Subject: [PATCH 4/5] Remove 3.1 from builds --- .github/workflows/codeql-analysis.yml | 1 - .github/workflows/test.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4ff6281..dfcd667 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,7 +30,6 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 3.1.x 6.0.x 7.0.x 8.0.x diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index afda726..0e87535 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,6 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 3.1.x 6.0.x 7.0.x 8.0.x From b6ad9a557d5b1557dc60a1bb3b699c4852c8d43e Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 15 Nov 2023 10:55:26 -0800 Subject: [PATCH 5/5] Mark overrides of obsolete members obsolete These are obsolete in newer .NET versions. --- MaxMind.Db/DeserializationException.cs | 3 +++ MaxMind.Db/InvalidDatabaseException.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/MaxMind.Db/DeserializationException.cs b/MaxMind.Db/DeserializationException.cs index aff7830..5bd62ef 100644 --- a/MaxMind.Db/DeserializationException.cs +++ b/MaxMind.Db/DeserializationException.cs @@ -43,6 +43,9 @@ public DeserializationException(string message, Exception innerException) /// /// The SerializationInfo with data. /// The source for this deserialization. +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif private DeserializationException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/MaxMind.Db/InvalidDatabaseException.cs b/MaxMind.Db/InvalidDatabaseException.cs index 76a43f6..86371b9 100644 --- a/MaxMind.Db/InvalidDatabaseException.cs +++ b/MaxMind.Db/InvalidDatabaseException.cs @@ -40,6 +40,9 @@ public InvalidDatabaseException(string message, Exception innerException) /// /// The SerializationInfo with data. /// The source for this deserialization. +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif private InvalidDatabaseException(SerializationInfo info, StreamingContext context) : base(info, context) { }