From dc333c6ac6c0c82b519e12e51aacc18b807a49b7 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Mon, 14 Oct 2024 23:43:55 +0200
Subject: [PATCH] Run tests and examples against .NET 9 RC2
---
.config/dotnet-tools.json | 2 +-
.github/workflows/build.yml | 6 ++++++
.github/workflows/codeql.yml | 2 ++
Directory.Build.props | 8 ++++++++
NuGet.config | 11 +++++++++++
package-versions.props | 16 ++++++++++++++++
src/Examples/DapperExample/DapperExample.csproj | 10 +++++++---
src/Examples/DapperExample/Program.cs | 9 +++++++--
.../DatabasePerTenantExample.csproj | 4 ++--
.../GettingStarted/GettingStarted.csproj | 2 +-
.../JsonApiDotNetCoreExample.csproj | 4 ++--
.../MultiDbContextExample.csproj | 2 +-
.../NoEntityFrameworkExample.csproj | 2 +-
.../ReportsExample/ReportsExample.csproj | 2 +-
test/AnnotationTests/AnnotationTests.csproj | 2 +-
test/DapperTests/DapperTests.csproj | 2 +-
test/DiscoveryTests/DiscoveryTests.csproj | 2 +-
.../JsonApiDotNetCoreTests.csproj | 2 +-
.../MultiDbContextTests.csproj | 2 +-
.../NoEntityFrameworkTests.csproj | 2 +-
.../SourceGeneratorTests.csproj | 6 +++++-
.../CapturingLoggerProvider.cs | 4 ++++
.../TestBuildingBlocks/TestBuildingBlocks.csproj | 4 ++--
test/UnitTests/UnitTests.csproj | 2 +-
tests.runsettings | 1 -
25 files changed, 84 insertions(+), 25 deletions(-)
create mode 100644 NuGet.config
diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index af4aa748d7..bd2f29bd33 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
- "version": "2024.2.6",
+ "version": "2024.3.0-eap04",
"commands": [
"jb"
],
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index da0993c185..6a16f9c5db 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -48,6 +48,8 @@ jobs:
dotnet-version: |
6.0.x
8.0.x
+ 9.0.x
+ dotnet-quality: 'preview'
- name: Show installed versions
shell: pwsh
run: |
@@ -166,6 +168,8 @@ jobs:
dotnet-version: |
6.0.x
8.0.x
+ 9.0.x
+ dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v4
- name: Restore tools
@@ -221,6 +225,8 @@ jobs:
dotnet-version: |
6.0.x
8.0.x
+ 9.0.x
+ dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v4
with:
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index eb0375769e..bb217b8983 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -29,6 +29,8 @@ jobs:
dotnet-version: |
6.0.x
8.0.x
+ 9.0.x
+ dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v4
- name: Initialize CodeQL
diff --git a/Directory.Build.props b/Directory.Build.props
index 6c68a15073..7d51f982cb 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -24,6 +24,14 @@
$(NoWarn);$(UseCollectionExpressionRules)
+
+
+ preview
+ true
+ direct
+ $(NoWarn);NU1608;NETSDK1215
+
+
$(NoWarn);AV2210
diff --git a/NuGet.config b/NuGet.config
new file mode 100644
index 0000000000..ffc65557fc
--- /dev/null
+++ b/NuGet.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/package-versions.props b/package-versions.props
index ed9b06b1aa..a6c3cb31aa 100644
--- a/package-versions.props
+++ b/package-versions.props
@@ -20,6 +20,18 @@
2.8.*
+
+
+ N/A
+
+
+ 9.0.*-*
+ 9.0.0-rtm.24508.5
+ 9.0.0-rc.2-ci.20240930T080442
+ 9.0.0-*
+ $(AspNetCoreVersion)
+
+
8.0.0
@@ -27,6 +39,8 @@
8.0.*
8.0.*
+ $(EntityFrameworkCoreVersion)
+ $(EntityFrameworkCoreVersion)
$(AspNetCoreVersion)
@@ -38,6 +52,8 @@
6.0.*
2.1.*
7.0.*
+ $(EntityFrameworkCoreVersion)
+ $(EntityFrameworkCoreVersion)
8.0.*
diff --git a/src/Examples/DapperExample/DapperExample.csproj b/src/Examples/DapperExample/DapperExample.csproj
index f49c3e4b40..3b065969f8 100644
--- a/src/Examples/DapperExample/DapperExample.csproj
+++ b/src/Examples/DapperExample/DapperExample.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
@@ -14,8 +14,12 @@
+
+
+
+
-
-
+
+
diff --git a/src/Examples/DapperExample/Program.cs b/src/Examples/DapperExample/Program.cs
index f7bf198af9..31e5814e5b 100644
--- a/src/Examples/DapperExample/Program.cs
+++ b/src/Examples/DapperExample/Program.cs
@@ -31,8 +31,13 @@
}
case DatabaseProvider.MySql:
{
- builder.Services.AddMySql(connectionString, ServerVersion.AutoDetect(connectionString),
- optionsAction: options => SetDbContextDebugOptions(options));
+#if NET9_0_OR_GREATER
+ ServerVersion serverVersion = await ServerVersion.AutoDetectAsync(connectionString);
+#else
+ ServerVersion serverVersion = ServerVersion.AutoDetect(connectionString);
+#endif
+
+ builder.Services.AddMySql(connectionString, serverVersion, optionsAction: options => SetDbContextDebugOptions(options));
break;
}
diff --git a/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj b/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj
index 0ccb4bbc5f..f6f17920ac 100644
--- a/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj
+++ b/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
@@ -13,6 +13,6 @@
-
+
diff --git a/src/Examples/GettingStarted/GettingStarted.csproj b/src/Examples/GettingStarted/GettingStarted.csproj
index 1f4645f323..22fc0529b1 100644
--- a/src/Examples/GettingStarted/GettingStarted.csproj
+++ b/src/Examples/GettingStarted/GettingStarted.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj b/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj
index 0ccb4bbc5f..f6f17920ac 100644
--- a/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj
+++ b/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
@@ -13,6 +13,6 @@
-
+
diff --git a/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj b/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj
index 1f4645f323..22fc0529b1 100644
--- a/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj
+++ b/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj b/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj
index c5b18320f0..c45552dc2d 100644
--- a/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj
+++ b/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/src/Examples/ReportsExample/ReportsExample.csproj b/src/Examples/ReportsExample/ReportsExample.csproj
index bff4909317..3f2c288b23 100644
--- a/src/Examples/ReportsExample/ReportsExample.csproj
+++ b/src/Examples/ReportsExample/ReportsExample.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/test/AnnotationTests/AnnotationTests.csproj b/test/AnnotationTests/AnnotationTests.csproj
index 081046adb0..7c5e5f3ae0 100644
--- a/test/AnnotationTests/AnnotationTests.csproj
+++ b/test/AnnotationTests/AnnotationTests.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0;netstandard2.0
+ net9.0;net8.0;net6.0;netstandard2.0
diff --git a/test/DapperTests/DapperTests.csproj b/test/DapperTests/DapperTests.csproj
index 45d9c6a88d..1420e0dd60 100644
--- a/test/DapperTests/DapperTests.csproj
+++ b/test/DapperTests/DapperTests.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/test/DiscoveryTests/DiscoveryTests.csproj b/test/DiscoveryTests/DiscoveryTests.csproj
index a64d3be689..295d5340fa 100644
--- a/test/DiscoveryTests/DiscoveryTests.csproj
+++ b/test/DiscoveryTests/DiscoveryTests.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj b/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
index 38d665aa5b..95a623d0f9 100644
--- a/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
+++ b/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/test/MultiDbContextTests/MultiDbContextTests.csproj b/test/MultiDbContextTests/MultiDbContextTests.csproj
index 54497bfada..6466d8d75f 100644
--- a/test/MultiDbContextTests/MultiDbContextTests.csproj
+++ b/test/MultiDbContextTests/MultiDbContextTests.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
index 080666d491..968d798be3 100644
--- a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
+++ b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/test/SourceGeneratorTests/SourceGeneratorTests.csproj b/test/SourceGeneratorTests/SourceGeneratorTests.csproj
index e28bdc20d1..3f6487aec1 100644
--- a/test/SourceGeneratorTests/SourceGeneratorTests.csproj
+++ b/test/SourceGeneratorTests/SourceGeneratorTests.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
@@ -15,6 +15,10 @@
+
+
+
+
diff --git a/test/TestBuildingBlocks/CapturingLoggerProvider.cs b/test/TestBuildingBlocks/CapturingLoggerProvider.cs
index 3996b1c9e2..38ec60ed3a 100644
--- a/test/TestBuildingBlocks/CapturingLoggerProvider.cs
+++ b/test/TestBuildingBlocks/CapturingLoggerProvider.cs
@@ -10,7 +10,11 @@ public sealed class CapturingLoggerProvider : ILoggerProvider
private static readonly Func DefaultFilter = (_, _) => true;
private readonly Func _filter;
+#if NET9_0_OR_GREATER
+ private readonly Lock _lockObject = new();
+#else
private readonly object _lockObject = new();
+#endif
private readonly List _messages = [];
public CapturingLoggerProvider()
diff --git a/test/TestBuildingBlocks/TestBuildingBlocks.csproj b/test/TestBuildingBlocks/TestBuildingBlocks.csproj
index 40e10eb297..7a983627a5 100644
--- a/test/TestBuildingBlocks/TestBuildingBlocks.csproj
+++ b/test/TestBuildingBlocks/TestBuildingBlocks.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
@@ -17,7 +17,7 @@
-
+
diff --git a/test/UnitTests/UnitTests.csproj b/test/UnitTests/UnitTests.csproj
index 99fc7ce781..e977ac0c8c 100644
--- a/test/UnitTests/UnitTests.csproj
+++ b/test/UnitTests/UnitTests.csproj
@@ -1,6 +1,6 @@
- net8.0;net6.0
+ net9.0;net8.0;net6.0
diff --git a/tests.runsettings b/tests.runsettings
index 14974e19f3..036b7d7044 100644
--- a/tests.runsettings
+++ b/tests.runsettings
@@ -1,7 +1,6 @@
- aggressive
true