diff --git a/.travis.yml b/.travis.yml index 904fab094..80b00230a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: csharp sudo: required mono: none -dist: xenial +dist: focal branches: except: @@ -12,13 +12,12 @@ branches: matrix: include: - - dotnet: 3.1.300 - env: TARGETF="netcoreapp3.1" BUILD_EXAMPLES="1" BuildCoreOnly=True NETCORE_RUNTIME="3.1" RunCodeAnalyzers="True" - - dotnet: 2.1.202 - env: TARGETF="netcoreapp2.0" BUILD_EXAMPLES="0" BuildCoreOnly=True NETCORE_RUNTIME="2.0" RunCodeAnalyzers="True" - -before_install: - - sudo apt-get -y install dotnet-sdk-3.1 + - dotnet: 8.0.200 + env: TARGETF="net8" BUILD_EXAMPLES="1" BuildCoreOnly=True CASSANDRA_NETCORE_RUNTIME="8" RunCodeAnalyzers="True" + - dotnet: 6.0.419 + env: TARGETF="net6" BUILD_EXAMPLES="0" BuildCoreOnly=True CASSANDRA_NETCORE_RUNTIME="6" RunCodeAnalyzers="True" + - dotnet: 7.0.406 + env: TARGETF="net7" BUILD_EXAMPLES="0" BuildCoreOnly=True CASSANDRA_NETCORE_RUNTIME="7" RunCodeAnalyzers="True" script: - dotnet --info diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a18f94ed..624e866b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # ChangeLog - DataStax C# Driver +## 3.20.1 + +2024-03-08 + +### Bug fixes + +* [[CSHARP-1007](https://datastax-oss.atlassian.net/browse/CSHARP-1007)] Build fails with .NET 7+ when using operators with CqlFunction and Guid (in LINQ statements) + +### Other + +* [[CSHARP-1008](https://datastax-oss.atlassian.net/browse/CSHARP-1008)] Exclude target frameworks which are EOL from test projects and add newer ones + ## 3.20.0 2024-01-30 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 092bbea48..4434730d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,17 +94,17 @@ In both cases, the `CASSANDRA_VERSION` environment variable determines which ser ## Building the driver and running tests -DataStax C# drivers support .NET 4.5.2+ and .NET Core 2.1+. To run the code analyzers you need the .NET Core 3.1 SDK. +DataStax C# drivers target .NET Framework 4.5.2 and .NET Standard 2.0. The test projects target .NET Framework 4.6.2, 4.7.2, 4.8.1 and .NET 6, 7 and 8. To run the code analyzers you need the .NET 8 SDK. ### Prerequisites -- [.NET Core 3.1 SDK][dotnetcoresdk] +- [.NET 8 SDK][dotnetsdk] ### IDE Support -You can build and run tests on Visual Studio 2019+ and JetBrains Rider by opening the solution file `Cassandra.sln` with any of those applications. +You can build and run tests on Visual Studio 2022+ and JetBrains Rider by opening the solution file `Cassandra.sln` with any of those applications. -To run the code analyzers you need to update these IDEs to a version that supports `.editorconfig` because the code analysis settings are set on that file. In the case of Visual Studio, [you need Visual Studio 2019 16.3+][vs2019analyzers] because previous versions don't support nested `.editorconfig` files and we have a couple of these on the codebase. +To run the code analyzers you need to update these IDEs to a version that supports `.editorconfig` because the code analysis settings are set on that file. In the case of Visual Studio, old versions don't support nested `.editorconfig` files and we have a couple of these on the codebase. You can also use Visual Studio Code although the repository doesn't contain the configuration for it. @@ -115,14 +115,14 @@ dotnet restore src dotnet build src/Cassandra.sln ``` -On Windows, the command `dotnet build src/Cassandra.sln` should succeed while on macOS / Linux it may fail due to the lack of support for .NET Framework builds on non-Windows platforms. In these environments you need to specify a .NET Core target framework in order to successfully build the project. +On Windows, the command `dotnet build src/Cassandra.sln` should succeed while on macOS / Linux it may fail due to the lack of support for .NET Framework builds on non-Windows platforms. In these environments you need to specify a .NET target framework in order to successfully build the project. You can build specific projects against specific target frameworks on any platform like this: ```bash dotnet build src/Cassandra/Cassandra.csproj -f netstandard2.0 -dotnet build src/Cassandra.Tests/Cassandra.Tests.csproj -f netcoreapp3.1 -dotnet build src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -f netcoreapp3.1 +dotnet build src/Cassandra.Tests/Cassandra.Tests.csproj -f net8 +dotnet build src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -f net8 ``` Alternatively you can set the `BuildCoreOnly` environment variable which will cause the projects to support .NET Core / .NET Standard targets only (you can see the conditions on the `.csproj` files). @@ -130,23 +130,22 @@ Alternatively you can set the `BuildCoreOnly` environment variable which will ca ### Running Unit Tests ```bash -dotnet test src/Cassandra.Tests/Cassandra.Tests.csproj -f netcoreapp3.1 +dotnet test src/Cassandra.Tests/Cassandra.Tests.csproj -f net8 ``` -The target frameworks supported by the test projects are `netcoreapp3.1` and `net462` (by default). If you set the `BuildAllTargets` environment variable, the test projects will support these targets: +The target frameworks supported by the test projects are `net8` and `net481` (by default). If you set the `BuildAllTargets` environment variable, the test projects will support these targets: -- `net452` - `net462` - `net472` -- `net48` -- `netcoreapp2.0` (not LTS, might be removed at some point) -- `netcoreapp2.1` -- `netcoreapp3.1` +- `net481` +- `net6` +- `net7`(not LTS, might be removed at some point) +- `net8` Running the unit tests for a single target should take no more than 5 minutes (usually less): ```bash -dotnet test src/Cassandra.Tests/Cassandra.Tests.csproj -c Release -f netcoreapp3.1 -l "console;verbosity=detailed" +dotnet test src/Cassandra.Tests/Cassandra.Tests.csproj -c Release -f net8 -l "console;verbosity=detailed" ``` ### Running Integration Tests @@ -187,7 +186,7 @@ Integration tests are tagged with one or more categories. You can see the list o CCM tests usually take a bit longer to run so if you want a quick validation you might prefer to run the simulacron tests only. You can do this by running the tests that don't have the `realcluster` or `realclusterlong` categories: ```bash -dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -c Release -f netcoreapp3.1 --filter "(TestCategory!=realcluster)&(TestCategory!=realclusterlong)" -l "console;verbosity=detailed" +dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -c Release -f net8 --filter "(TestCategory!=realcluster)&(TestCategory!=realclusterlong)" -l "console;verbosity=detailed" ``` This currently takes less than 10 minutes. @@ -197,7 +196,7 @@ If you get this error: `Simulacron start error: java.net.BindException: Address To run the integration tests suite that the **per commit** schedule builds use on Appveyor and Jenkins, do this: ```bash -dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -c Release -f netcoreapp3.1 --filter "(TestCategory!=realclusterlong)" -l "console;verbosity=detailed" +dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -c Release -f net8 --filter "(TestCategory!=realclusterlong)" -l "console;verbosity=detailed" ``` This test suite contains all simulacron tests and most ccm tests. This currently takes less than 30 minutes for Apache Cassandra 3.11.x (which is the current default server version). You can change this by setting the `CASSANDRA_VERSION` environment variable or changing the default value of the `TestClusterManager.CassandraVersionString` property (don't commit this change). @@ -205,7 +204,7 @@ This test suite contains all simulacron tests and most ccm tests. This currently To run all the integration tests (those that run on the **weekly** and **nightly** schedules), don't specify any filter: ```bash -dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -c Release -f netcoreapp3.1 -l "console;verbosity=detailed" +dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -c Release -f net8 -l "console;verbosity=detailed" ``` This currently takes less than 45 minutes for Apache Cassandra 3.11.x. diff --git a/Jenkinsfile b/Jenkinsfile index c78c7c4c6..c2e1bf366 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -86,16 +86,30 @@ def initializeEnvironment() { gci env:* | sort-object name ''' } else { - sh label: 'Copy SSL files', script: '''#!/bin/bash -le - cp -r ${HOME}/ccm/ssl $HOME/ssl - ''' - + sh label: 'Download Apache Cassandra® or DataStax Enterprise', script: '''#!/bin/bash -le . ${CCM_ENVIRONMENT_SHELL} ${SERVER_VERSION} echo "CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION}" >> ${HOME}/environment.txt ''' - +//https://learn.microsoft.com/en-us/dotnet/core/compatibility/cryptography/5.0/default-cipher-suites-for-tls-on-linux + sh label: 'Setup custom openssl.cnf due to .NET 5+ TLS changes on Linux', script: '''#!/bin/bash -le + cat >> /home/jenkins/openssl.cnf << OPENSSL_EOF +openssl_conf = default_conf + +[default_conf] +ssl_conf = ssl_sect + +[ssl_sect] +system_default = system_default_sect + +[system_default_sect] +MinProtocol = TLSv1 +CipherString = @SECLEVEL=2:kEECDH:kRSA:kEDH:kPSK:kDHEPSK:kECDHEPSK:-aDSS:-3DES:!DES:!RC4:!RC2:!IDEA:-SEED:!eNULL:!aNULL:!MD5:-SHA384:-CAMELLIA:-ARIA:-AESCCM8 +Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_SHA256 +OPENSSL_EOF + echo "OPENSSL_CONF=/home/jenkins/openssl.cnf" >> ${HOME}/environment.txt + ''' if (env.SERVER_VERSION.split('-')[0] == 'dse') { env.DSE_FIXED_VERSION = env.SERVER_VERSION.split('-')[1] sh label: 'Update environment for DataStax Enterprise', script: '''#!/bin/bash -le @@ -200,7 +214,7 @@ def buildDriver() { sh label: 'Build the driver for mono', script: '''#!/bin/bash -le export BuildMonoOnly=True export RunCodeAnalyzers=False - export MSBuildSDKsPath=/opt/dotnet/sdk/$(dotnet --version)/Sdks + export MSBuildSDKsPath=/home/jenkins/dotnetcli/sdk/$(dotnet --version)/Sdks msbuild /t:restore /v:m /p:RestoreDisableParallel=true src/Cassandra.sln || true msbuild /t:restore /v:m /p:RestoreDisableParallel=true src/Cassandra.sln msbuild /p:Configuration=Release /v:m /p:RestoreDisableParallel=true /p:DynamicConstants=LINUX src/Cassandra.sln || true @@ -262,7 +276,7 @@ def executeTests(perCommitSchedule) { set -o allexport . ${HOME}/environment.txt set +o allexport - +export OPENSSL_CONF=/home/jenkins/openssl.cnf dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -v n -f ${DOTNET_VERSION} -c Release --filter $DOTNET_TEST_FILTER --logger "xunit;LogFilePath=../../TestResult_xunit.xml" ''' } @@ -413,20 +427,30 @@ pipeline { } axis { name 'DOTNET_VERSION' - values 'mono', 'netcoreapp3.1' + values 'mono', 'net8', 'net6' } } excludes { exclude { axis { name 'DOTNET_VERSION' - values 'mono' + values 'mono', 'net8' } axis { name 'SERVER_VERSION' values '2.2', '3.0', 'dse-5.1.35', 'dse-6.8.30' } } + exclude { + axis { + name 'DOTNET_VERSION' + values 'net8' + } + axis { + name 'SERVER_VERSION' + values 'dse-6.7.17', '3.11' + } + } } agent { diff --git a/Jenkinsfile.scheduled b/Jenkinsfile.scheduled index a4a82fc32..4b755e168 100644 --- a/Jenkinsfile.scheduled +++ b/Jenkinsfile.scheduled @@ -95,7 +95,24 @@ def initializeEnvironment() { echo "CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION}" >> ${HOME}/environment.txt ''' - +//https://learn.microsoft.com/en-us/dotnet/core/compatibility/cryptography/5.0/default-cipher-suites-for-tls-on-linux + sh label: 'Setup custom openssl.cnf due to .NET 5+ TLS changes on Linux', script: '''#!/bin/bash -le + cat >> /home/jenkins/openssl.cnf << OPENSSL_EOF +openssl_conf = default_conf + +[default_conf] +ssl_conf = ssl_sect + +[ssl_sect] +system_default = system_default_sect + +[system_default_sect] +MinProtocol = TLSv1 +CipherString = @SECLEVEL=2:kEECDH:kRSA:kEDH:kPSK:kDHEPSK:kECDHEPSK:-aDSS:-3DES:!DES:!RC4:!RC2:!IDEA:-SEED:!eNULL:!aNULL:!MD5:-SHA384:-CAMELLIA:-ARIA:-AESCCM8 +Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_SHA256 +OPENSSL_EOF + echo "OPENSSL_CONF=/home/jenkins/openssl.cnf" >> ${HOME}/environment.txt + ''' if (env.SERVER_VERSION.split('-')[0] == 'dse') { env.DSE_FIXED_VERSION = env.SERVER_VERSION.split('-')[1] sh label: 'Update environment for DataStax Enterprise', script: '''#!/bin/bash -le @@ -200,7 +217,7 @@ def buildDriver() { sh label: 'Build the driver for mono', script: '''#!/bin/bash -le export BuildMonoOnly=True export RunCodeAnalyzers=False - export MSBuildSDKsPath=/opt/dotnet/sdk/$(dotnet --version)/Sdks + export MSBuildSDKsPath=/home/jenkins/dotnetcli/sdk/$(dotnet --version)/Sdks msbuild /t:restore /v:m /p:RestoreDisableParallel=true src/Cassandra.sln || true msbuild /t:restore /v:m /p:RestoreDisableParallel=true src/Cassandra.sln msbuild /p:Configuration=Release /v:m /p:RestoreDisableParallel=true /p:DynamicConstants=LINUX src/Cassandra.sln || true @@ -397,7 +414,7 @@ pipeline { environment { DOTNET_CLI_TELEMETRY_OPTOUT = '1' - SERVER_VERSION_SNI = 'dse-6.7.17' + SERVER_VERSION_SNI = 'dse-6.8.30' SERVER_VERSION_SNI_WINDOWS = '3.11' SIMULACRON_PATH = '/home/jenkins/simulacron.jar' SIMULACRON_PATH_WINDOWS = 'C:\\Users\\Admin\\simulacron.jar' @@ -424,7 +441,7 @@ pipeline { // ## // # Building on Linux - // # - Do not build using net452 and net461 + // # - Do not build using net framework // # - Target all Apache Cassandra� and DataStax Enterprise versions for netcoreapp2.1 // ## // H 0 * * 1-5 %CI_SCHEDULE=NIGHTLY;CI_SCHEDULE_DOTNET_VERSION=ALL;CI_SCHEDULE_SERVER_VERSION=2.2 3.11 dse-5.1 dse-6.7;CI_SCHEDULE_OS_VERSION=ubuntu/bionic64/csharp-driver @@ -445,7 +462,7 @@ pipeline { } axis { name 'DOTNET_VERSION' - values 'mono', 'netcoreapp2.1', 'netcoreapp3.1' + values 'mono', 'net6', 'net7', 'net8' } } excludes { @@ -462,13 +479,23 @@ pipeline { exclude { axis { name 'DOTNET_VERSION' - values 'netcoreapp2.1' + values 'net7', 'net8' } axis { name 'SERVER_VERSION' values '2.1', '2.2', '3.0', 'dse-5.1.35', 'dse-6.0.18' } } + exclude { + axis { + name 'DOTNET_VERSION' + values 'net7' + } + axis { + name 'SERVER_VERSION' + values 'dse-6.7.17' + } + } } agent { @@ -540,9 +567,9 @@ pipeline { // # Building on Windows // # - Do not build using mono - // # - Target Apache Cassandra� v3.11.x for netcoreapp2.1 - // # - Target Apache Cassandra� v2.1.x, v2.2.x, v3.11.x for net452 - // # - Target Apache Cassandra� v2.2.x, v3.11.x for net461 + // # - Target Apache Cassandra� v3.11.x for net8 and net481 + // # - Target Apache Cassandra� v2.1.x, v2.2.x, v3.11.x for net462 + // # - Target Apache Cassandra� v2.2.x, v3.11.x for net472 // ## // H 2 * * 1-5 %CI_SCHEDULE=NIGHTLY;CI_SCHEDULE_DOTNET_VERSION=netcoreapp2.1;CI_SCHEDULE_SERVER_VERSION=3.11;CI_SCHEDULE_OS_VERSION=win/cs // H 2 * * 1-5 %CI_SCHEDULE=NIGHTLY;CI_SCHEDULE_DOTNET_VERSION=net452;CI_SCHEDULE_SERVER_VERSION=2.1 2.2 3.11;CI_SCHEDULE_OS_VERSION=win/cs @@ -558,24 +585,24 @@ pipeline { } axis { name 'DOTNET_VERSION' - values 'netcoreapp2.1', 'netcoreapp3.1', 'net452', 'net462', 'net472', 'net48' + values 'net8', 'net462', 'net472', 'net481' } } excludes { exclude { axis { name 'DOTNET_VERSION' - values 'net462' + values 'net472' } axis { name 'SERVER_VERSION' - values '2.1' + values '2.1', '3.11' } } exclude { axis { name 'DOTNET_VERSION' - values 'netcoreapp3.1' + values 'net8' } axis { name 'SERVER_VERSION' @@ -585,23 +612,13 @@ pipeline { exclude { axis { name 'DOTNET_VERSION' - values 'net472', 'net48' + values 'net481' } axis { name 'SERVER_VERSION' values '2.1', '2.2', '4.0' } } - exclude { - axis { - name 'DOTNET_VERSION' - values 'net452', 'netcoreapp2.1' - } - axis { - name 'SERVER_VERSION' - values '2.1' - } - } } agent { @@ -686,18 +703,28 @@ pipeline { } axis { name 'DOTNET_VERSION' - values 'mono', 'netcoreapp2.1', 'netcoreapp3.1' + values 'mono', 'net6', 'net7', 'net8' } } excludes { exclude { axis { name 'DOTNET_VERSION' - values 'netcoreapp2.1' + values 'net8', 'net7' + } + axis { + name 'SERVER_VERSION' + values '2.1', '2.2', 'dse-6.0.18', 'dse-5.1.35' + } + } + exclude { + axis { + name 'DOTNET_VERSION' + values 'net7' } axis { name 'SERVER_VERSION' - values '2.1', 'dse-6.0.18' + values '3.11', 'dse-6.7.17' } } } @@ -780,14 +807,14 @@ pipeline { } axis { name 'DOTNET_VERSION' - values 'netcoreapp2.1', 'netcoreapp3.1', 'net452', 'net462', 'net472', 'net48' + values 'net6', 'net7', 'net8', 'net462', 'net472', 'net481' } } excludes { exclude { axis { name 'DOTNET_VERSION' - values 'net452', 'net472', 'net48', 'netcoreapp2.1' + values 'net472', 'net481', 'net6', 'net7' } axis { name 'SERVER_VERSION' @@ -797,7 +824,7 @@ pipeline { exclude { axis { name 'DOTNET_VERSION' - values 'net472', 'net48' + values 'net472', 'net481', 'net7' } axis { name 'SERVER_VERSION' diff --git a/README.md b/README.md index e8d732eae..56837ffee 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ It also provides additional features for [DataStax Enterprise][dse]: - [DSE graph][dse-graph] integration. - Serializers for geospatial types which integrate seamlessly with the driver. -The driver supports .NET Framework 4.5.2+ and .NET Core 2.1+ ([LTS](https://dotnet.microsoft.com/platform/support/policy/dotnet-core)). +The driver targets .NET Framework 4.5.2 and .NET Standard 2.0. For more detailed information about platform compatibility, check [this section](#compatibility). ## Installation @@ -388,7 +388,22 @@ session.Execute(statement); - Apache Cassandra versions 2.0 and above. - DataStax Enterprise versions 4.8 and above. -- .NET Framework versions 4.5.2 and above and .NET Core versions 2.1 and above. +- The driver targets .NET Framework 4.5.2 and .NET Standard 2.0 + +Here is a list of platforms and .NET targets that Datastax uses when testing this driver: + +| Platform | net462 | net472 | net481 | net6 | net7 | net8 | +|-----------------------|--------|--------|--------|------|------|-------| +| Windows Server 2019³ | ✓ | ✓ | ✓ | ✓² | ✓¹ | ✓ | +| Ubuntu 18.04 | - | - | - | ✓ | ✓ | ✓ | + +¹ No tests are run for the `net7` target on the Windows platform but `net7` is still considered fully supported. + +² Only unit tests are ran for the `net6` target on the windows platform but `net6` is still considered fully supported. + +³ Appveyor's `Visual Studio 2022` image is used for these tests. + +Mono `6.12.0` is also used to run `net462` tests on `Ubuntu 18.04` but Datastax can't guarantee that the driver fully supports Mono in a production environment. Datastax recommends the modern cross platform .NET platform instead. Note: DataStax products do not support big-endian systems. diff --git a/appveyor.yml b/appveyor.yml index 6d9b9009d..79e164447 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,7 @@ cache: - C:\ProgramData\chocolatey\lib -> .\build\appveyor_install.ps1 - C:\Users\appveyor\.ccm\repository -> .\build\appveyor_install.ps1 - C:\Users\appveyor\deps -> .\build\appveyor_install.ps1 -image: Visual Studio 2019 +image: Visual Studio 2022 environment: #APPVEYOR_RDP_PASSWORD: Yy64rr9aB6IW NUNIT_PATH: nunit3-console @@ -16,10 +16,16 @@ environment: - TARGET: net462 CI_TYPE: UNIT PROJECT: Cassandra.Tests - - TARGET: net452 + - TARGET: net472 + CI_TYPE: UNIT + PROJECT: Cassandra.Tests + - TARGET: net481 CI_TYPE: UNIT PROJECT: Cassandra.Tests - - TARGET: netcoreapp3.1 + - TARGET: net6 + CI_TYPE: UNIT + PROJECT: Cassandra.Tests + - TARGET: net8 CI_TYPE: UNIT PROJECT: Cassandra.Tests - TARGET: net472 @@ -30,15 +36,11 @@ environment: CASSANDRA_VERSION: 3.11.6 CI_TYPE: INTEGRATION_FULL PROJECT: Cassandra.IntegrationTests - - TARGET: netcoreapp3.1 + - TARGET: net8 CASSANDRA_VERSION: 3.11.6 CI_TYPE: INTEGRATION PROJECT: Cassandra.IntegrationTests - - TARGET: net452 - CASSANDRA_VERSION: 2.2.7 - CI_TYPE: INTEGRATION - PROJECT: Cassandra.IntegrationTests - - TARGET: net48 + - TARGET: net481 CASSANDRA_VERSION: 3.11.6 CI_TYPE: INTEGRATION PROJECT: Cassandra.IntegrationTests diff --git a/examples/ColumnEncryption/ColumnEncryptionExample/ColumnEncryptionExample.csproj b/examples/ColumnEncryption/ColumnEncryptionExample/ColumnEncryptionExample.csproj index 9d0cd8c3b..4fda79477 100644 --- a/examples/ColumnEncryption/ColumnEncryptionExample/ColumnEncryptionExample.csproj +++ b/examples/ColumnEncryption/ColumnEncryptionExample/ColumnEncryptionExample.csproj @@ -8,7 +8,7 @@ You can should replace the project reference with the package reference of the d --> Exe - netcoreapp2.1 + net8 ColumnEncryptionExample ColumnEncryptionExample diff --git a/examples/ConcurrentExecutions/ExecuteInLoop/ExecuteInLoop.csproj b/examples/ConcurrentExecutions/ExecuteInLoop/ExecuteInLoop.csproj index d4d97c6b1..1abf55e9a 100644 --- a/examples/ConcurrentExecutions/ExecuteInLoop/ExecuteInLoop.csproj +++ b/examples/ConcurrentExecutions/ExecuteInLoop/ExecuteInLoop.csproj @@ -8,7 +8,7 @@ You can should replace the project reference with the package reference of the d --> Exe - netcoreapp2.1 + net8 ExecuteInLoop ExecuteInLoop diff --git a/examples/Mapper/MultipleKeyspacesSingleSession/MultipleKeyspacesSingleSession.csproj b/examples/Mapper/MultipleKeyspacesSingleSession/MultipleKeyspacesSingleSession.csproj index 45e024184..fe52a9166 100644 --- a/examples/Mapper/MultipleKeyspacesSingleSession/MultipleKeyspacesSingleSession.csproj +++ b/examples/Mapper/MultipleKeyspacesSingleSession/MultipleKeyspacesSingleSession.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net8 diff --git a/examples/Metrics/AppMetricsGraphite/AppMetricsGraphite.csproj b/examples/Metrics/AppMetricsGraphite/AppMetricsGraphite.csproj index a07d58012..eefefdbb8 100644 --- a/examples/Metrics/AppMetricsGraphite/AppMetricsGraphite.csproj +++ b/examples/Metrics/AppMetricsGraphite/AppMetricsGraphite.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.1 + net8 diff --git a/examples/SecureConnectionBundle/MinimalExample/MinimalExample.csproj b/examples/SecureConnectionBundle/MinimalExample/MinimalExample.csproj index 300cd1c37..3f0640513 100644 --- a/examples/SecureConnectionBundle/MinimalExample/MinimalExample.csproj +++ b/examples/SecureConnectionBundle/MinimalExample/MinimalExample.csproj @@ -8,7 +8,7 @@ You can should replace the project reference with the package reference of the d --> Exe - netcoreapp2.1 + net8 diff --git a/examples/Ssl/SslServerAuthOnly/SslServerAuthOnly.csproj b/examples/Ssl/SslServerAuthOnly/SslServerAuthOnly.csproj index e7d92d2bd..425100e94 100644 --- a/examples/Ssl/SslServerAuthOnly/SslServerAuthOnly.csproj +++ b/examples/Ssl/SslServerAuthOnly/SslServerAuthOnly.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.1 + net8 diff --git a/examples/Ssl/SslTwoWayAuth/SslTwoWayAuth.csproj b/examples/Ssl/SslTwoWayAuth/SslTwoWayAuth.csproj index e7d92d2bd..425100e94 100644 --- a/examples/Ssl/SslTwoWayAuth/SslTwoWayAuth.csproj +++ b/examples/Ssl/SslTwoWayAuth/SslTwoWayAuth.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.1 + net8 diff --git a/src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj b/src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj index 27af67ab3..03b66af4e 100644 --- a/src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj +++ b/src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj @@ -1,9 +1,10 @@  - net48;net462;net472;net452;netcoreapp3.1;netcoreapp2.0;netcoreapp2.1 - net462;netcoreapp3.1 - netcoreapp2.1;netcoreapp3.1 - netcoreapp2.0 + net8;net7;net6;net481;net462;net472 + net481;net8 + net6 + net7 + net8 net462 true NU1901;NU1902;NU1903;NU1904 @@ -15,20 +16,12 @@ true 7.1 - + $(DefineConstants);NETFRAMEWORK - + $(DefineConstants);NETCOREAPP - - - TargetFramework=net452 - - - TargetFramework=net452 - - TargetFramework=net461 @@ -51,64 +44,62 @@ TargetFramework=net452 - + TargetFramework=net461 - TargetFramework=net48 + TargetFramework=net481 TargetFramework=net452 - + TargetFramework=netstandard2.0 - TargetFramework=netcoreapp3.1 + TargetFramework=net8 TargetFramework=netstandard2.0 - + TargetFramework=netstandard2.0 - TargetFramework=netcoreapp2.1 + TargetFramework=net7 TargetFramework=netstandard2.0 - + TargetFramework=netstandard2.0 - TargetFramework=netcoreapp2.0 + TargetFramework=net6 TargetFramework=netstandard2.0 - - - + - + - - + + @@ -116,16 +107,16 @@ - + - + - - + + diff --git a/src/Cassandra.IntegrationTests/Core/PoolShortTests.cs b/src/Cassandra.IntegrationTests/Core/PoolShortTests.cs index 5ab63222f..4b3d5d2d8 100644 --- a/src/Cassandra.IntegrationTests/Core/PoolShortTests.cs +++ b/src/Cassandra.IntegrationTests/Core/PoolShortTests.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Security.Authentication; using System.Threading; using System.Threading.Tasks; using Cassandra.SessionManagement; @@ -234,9 +235,10 @@ public void Connect_With_Ssl_Test() //use ssl var testCluster = TestClusterManager.CreateNew(1, new TestClusterOptions { UseSsl = true }); +#pragma warning disable SYSLIB0039 // Type or member is obsolete using (var cluster = ClusterBuilder() .AddContactPoint(testCluster.InitialContactPoint) - .WithSSL(new SSLOptions().SetRemoteCertValidationCallback((a, b, c, d) => true)) + .WithSSL(new SSLOptions(SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12, false, (a, b, c, d) => true)) .Build()) { Assert.DoesNotThrow(() => @@ -245,6 +247,7 @@ public void Connect_With_Ssl_Test() TestHelper.Invoke(() => session.Execute("select * from system.local"), 10); }); } +#pragma warning restore SYSLIB0039 // Type or member is obsolete } finally { diff --git a/src/Cassandra.IntegrationTests/CqlFunctions/Structures/EntityWithNullableTimeUuid.cs b/src/Cassandra.IntegrationTests/CqlFunctions/Structures/EntityWithNullableTimeUuid.cs index 2193f24d9..002942e05 100644 --- a/src/Cassandra.IntegrationTests/CqlFunctions/Structures/EntityWithNullableTimeUuid.cs +++ b/src/Cassandra.IntegrationTests/CqlFunctions/Structures/EntityWithNullableTimeUuid.cs @@ -18,6 +18,8 @@ using System.Collections.Generic; using Cassandra.Data.Linq; using NUnit.Framework; +using NUnit.Framework.Internal; + #pragma warning disable 618 namespace Cassandra.IntegrationTests.CqlFunctions.Structures @@ -50,12 +52,17 @@ public static bool AssertListContains(List expectedE { foreach (var expectedEntity in expectedEntities) { - try + using (new TestExecutionContext.IsolatedContext()) { - AssertEquals(expectedEntity, actualEntity); - return true; + try + { + AssertEquals(expectedEntity, actualEntity); + return true; + } + catch (AssertionException) + { + } } - catch (AssertionException) { } } return false; } diff --git a/src/Cassandra.IntegrationTests/CqlFunctions/Structures/EntityWithTimeUuid.cs b/src/Cassandra.IntegrationTests/CqlFunctions/Structures/EntityWithTimeUuid.cs index b6720cb1f..b82936448 100644 --- a/src/Cassandra.IntegrationTests/CqlFunctions/Structures/EntityWithTimeUuid.cs +++ b/src/Cassandra.IntegrationTests/CqlFunctions/Structures/EntityWithTimeUuid.cs @@ -18,6 +18,8 @@ using System.Collections.Generic; using Cassandra.Data.Linq; using NUnit.Framework; +using NUnit.Framework.Internal; + #pragma warning disable 618 namespace Cassandra.IntegrationTests.CqlFunctions.Structures @@ -50,12 +52,17 @@ public static bool AssertListContains(List expectedEntities, { foreach (var expectedEntity in expectedEntities) { - try + using (new TestExecutionContext.IsolatedContext()) { - AssertEquals(expectedEntity, actualEntity); - return true; + try + { + AssertEquals(expectedEntity, actualEntity); + return true; + } + catch (AssertionException) + { + } } - catch (AssertionException) { } } return false; } diff --git a/src/Cassandra.IntegrationTests/Linq/Structures/AllDataTypesEntityUtil.cs b/src/Cassandra.IntegrationTests/Linq/Structures/AllDataTypesEntityUtil.cs index d0c43d2fb..be0f45c71 100644 --- a/src/Cassandra.IntegrationTests/Linq/Structures/AllDataTypesEntityUtil.cs +++ b/src/Cassandra.IntegrationTests/Linq/Structures/AllDataTypesEntityUtil.cs @@ -19,6 +19,8 @@ using Cassandra.Data.Linq; using Cassandra.IntegrationTests.TestBase; using NUnit.Framework; +using NUnit.Framework.Internal; + #pragma warning disable 618 namespace Cassandra.IntegrationTests.Linq.Structures @@ -78,30 +80,21 @@ public static void AssertEquals(IAllDataTypesEntity expectedEntity, IAllDataType Assert.AreEqual(expectedEntity.ListOfStringsType, actualEntity.ListOfStringsType); } - public static bool AssertListContains(List expectedEntities, IAllDataTypesEntity actualEntity) - { - foreach (var expectedEntity in expectedEntities) - { - try - { - AssertEquals(expectedEntity, actualEntity); - return true; - } - catch (AssertionException) { } - } - return false; - } - public static bool AssertListContains(List expectedEntities, AllDataTypesEntity actualEntity) { foreach (var expectedEntity in expectedEntities) { - try + using (new TestExecutionContext.IsolatedContext()) { - AssertEquals(expectedEntity, actualEntity); - return true; + try + { + AssertEquals(expectedEntity, actualEntity); + return true; + } + catch (AssertionException) + { + } } - catch (AssertionException) { } } return false; } diff --git a/src/Cassandra.IntegrationTests/Linq/Structures/ManyDataTypesEntity.cs b/src/Cassandra.IntegrationTests/Linq/Structures/ManyDataTypesEntity.cs index a9818d1ec..7f1c7f1bb 100644 --- a/src/Cassandra.IntegrationTests/Linq/Structures/ManyDataTypesEntity.cs +++ b/src/Cassandra.IntegrationTests/Linq/Structures/ManyDataTypesEntity.cs @@ -21,6 +21,8 @@ using Cassandra.IntegrationTests.SimulacronAPI; using Cassandra.IntegrationTests.TestBase; using NUnit.Framework; +using NUnit.Framework.Internal; + #pragma warning disable 618 namespace Cassandra.IntegrationTests.Linq.Structures @@ -131,12 +133,17 @@ public static bool ListContains(List expectedEntities, Many { foreach (var expectedEntity in expectedEntities) { - try + using (new TestExecutionContext.IsolatedContext()) { - expectedEntity.AssertEquals(actualEntity); - return true; + try + { + expectedEntity.AssertEquals(actualEntity); + return true; + } + catch (AssertionException) + { + } } - catch (AssertionException) { } } return false; } diff --git a/src/Cassandra.IntegrationTests/Linq/Structures/Movie.cs b/src/Cassandra.IntegrationTests/Linq/Structures/Movie.cs index 2b8c41539..60576c5e6 100644 --- a/src/Cassandra.IntegrationTests/Linq/Structures/Movie.cs +++ b/src/Cassandra.IntegrationTests/Linq/Structures/Movie.cs @@ -22,6 +22,8 @@ using Cassandra.IntegrationTests.SimulacronAPI.PrimeBuilder.Then; using Cassandra.IntegrationTests.TestBase; using NUnit.Framework; +using NUnit.Framework.Internal; + #pragma warning disable 618 namespace Cassandra.IntegrationTests.Linq.Structures @@ -86,12 +88,17 @@ public static bool ListContains(List expectedMovies, Movie actualMovie) { foreach (var expectedMovie in expectedMovies) { - try + using (new TestExecutionContext.IsolatedContext()) { - AssertEquals(actualMovie, expectedMovie); - return true; + try + { + AssertEquals(actualMovie, expectedMovie); + return true; + } + catch (AssertionException) + { + } } - catch (AssertionException) { } } return false; } diff --git a/src/Cassandra.IntegrationTests/Mapping/Structures/ManyDataTypesPoco.cs b/src/Cassandra.IntegrationTests/Mapping/Structures/ManyDataTypesPoco.cs index cbd98dfaa..613e08649 100644 --- a/src/Cassandra.IntegrationTests/Mapping/Structures/ManyDataTypesPoco.cs +++ b/src/Cassandra.IntegrationTests/Mapping/Structures/ManyDataTypesPoco.cs @@ -25,6 +25,7 @@ using Cassandra.Mapping; using NUnit.Framework; +using NUnit.Framework.Internal; #pragma warning disable 618 @@ -134,12 +135,17 @@ public static bool ListContains(List expectedEntities, ManyDa { foreach (var expectedEntity in expectedEntities) { - try + using (new TestExecutionContext.IsolatedContext()) { - expectedEntity.AssertEquals(actualEntity); - return true; + try + { + expectedEntity.AssertEquals(actualEntity); + return true; + } + catch (AssertionException) + { + } } - catch (AssertionException) { } } return false; } diff --git a/src/Cassandra.IntegrationTests/Mapping/Structures/NestedCollectionsPoco.cs b/src/Cassandra.IntegrationTests/Mapping/Structures/NestedCollectionsPoco.cs index db8ca7928..e51aa3019 100644 --- a/src/Cassandra.IntegrationTests/Mapping/Structures/NestedCollectionsPoco.cs +++ b/src/Cassandra.IntegrationTests/Mapping/Structures/NestedCollectionsPoco.cs @@ -22,6 +22,8 @@ using Cassandra.IntegrationTests.TestBase; using Cassandra.Mapping; using NUnit.Framework; +using NUnit.Framework.Internal; + #pragma warning disable 618 namespace Cassandra.IntegrationTests.Mapping.Structures @@ -103,12 +105,17 @@ public static bool ListContains(List expectedEntities, Ne { foreach (var expectedEntity in expectedEntities) { - try + using (new TestExecutionContext.IsolatedContext()) { - expectedEntity.AssertEquals(actualEntity); - return true; + try + { + expectedEntity.AssertEquals(actualEntity); + return true; + } + catch (AssertionException) + { + } } - catch (AssertionException) { } } return false; } diff --git a/src/Cassandra.IntegrationTests/Mapping/Tests/InsertTests.cs b/src/Cassandra.IntegrationTests/Mapping/Tests/InsertTests.cs index 984fc47d2..7cecd2750 100644 --- a/src/Cassandra.IntegrationTests/Mapping/Tests/InsertTests.cs +++ b/src/Cassandra.IntegrationTests/Mapping/Tests/InsertTests.cs @@ -681,6 +681,7 @@ private class PrivateClassWithClassNameCamelCase public string SomePartitionKey = "somePartitionKey"; } +#pragma warning disable CS8981 // The type name only contains lower-cased ascii characters. Such names may become reserved for the language. private class lowercaseclassnamepkcamelcase { public string SomePartitionKey = "somePartitionKey"; @@ -690,6 +691,7 @@ private class lowercaseclassnamepklowercase { public string somepartitionkey = "somePartitionKey"; } +#pragma warning restore CS8981 // The type name only contains lower-cased ascii characters. Such names may become reserved for the language. private class PocoWithAdditionalField { diff --git a/src/Cassandra.IntegrationTests/SimulacronAPI/PrimeBuilder/When/BatchQuery.cs b/src/Cassandra.IntegrationTests/SimulacronAPI/PrimeBuilder/When/BatchQuery.cs index cf178613d..a94299d20 100644 --- a/src/Cassandra.IntegrationTests/SimulacronAPI/PrimeBuilder/When/BatchQuery.cs +++ b/src/Cassandra.IntegrationTests/SimulacronAPI/PrimeBuilder/When/BatchQuery.cs @@ -23,9 +23,9 @@ public class BatchQuery { public string QueryOrId { get; set; } - public Dictionary ParamTypes { get; set; } + public Dictionary ParamTypes { get; set; } = new Dictionary(); - public Dictionary Params { get; set; } + public Dictionary Params { get; set; } = new Dictionary(); public IDictionary ToDictionary() { diff --git a/src/Cassandra.IntegrationTests/TestBase/Randomm.cs b/src/Cassandra.IntegrationTests/TestBase/Randomm.cs index 9f5841669..826a7a87c 100644 --- a/src/Cassandra.IntegrationTests/TestBase/Randomm.cs +++ b/src/Cassandra.IntegrationTests/TestBase/Randomm.cs @@ -20,17 +20,20 @@ namespace Cassandra.IntegrationTests.TestBase { - internal class Randomm : Random + internal class Randomm { [ThreadStatic] private static Randomm _rnd; + private readonly Random _r; + public static Randomm Instance { get { return Randomm._rnd ?? (Randomm._rnd = new Randomm(5)); } } - private Randomm(int seed) : base(seed) + private Randomm(int seed) { + _r = new Random(seed); } internal static object RandomVal(Type tp) @@ -40,9 +43,29 @@ internal static object RandomVal(Type tp) return ""; } + public int Next() + { + return _r.Next(); + } + + public int Next(int minValue, int maxValue) + { + return _r.Next(minValue, maxValue); + } + + public int Next(int maxValue) + { + return _r.Next(maxValue); + } + + public double NextDouble() + { + return _r.NextDouble(); + } + public float NextSingle() { - double numb = NextDouble(); + double numb = _r.NextDouble(); numb -= 0.5; numb *= 2; return float.MaxValue*(float) numb; @@ -50,7 +73,7 @@ public float NextSingle() public UInt16 NextUInt16() { - return (ushort) Next(0, 65535); + return (ushort) _r.Next(0, 65535); } public static int NextInt32() @@ -61,14 +84,14 @@ public static int NextInt32() public Int64 NextInt64() { var buffer = new byte[sizeof (Int64)]; - NextBytes(buffer); + _r.NextBytes(buffer); return BitConverter.ToInt64(buffer, 0); } public decimal NextDecimal() { - var scale = (byte) Next(29); - bool sign = Next(2) == 1; + var scale = (byte) _r.Next(29); + bool sign = _r.Next(2) == 1; return new decimal(Randomm.NextInt32(), Randomm.NextInt32(), @@ -108,13 +131,18 @@ public DateTimeOffset NextDateTimeOffset() public byte[] NextByte() { var btarr = new byte[NextUInt16()]; - NextBytes(btarr); + _r.NextBytes(btarr); return btarr; } + public void NextBytes(byte[] buffer) + { + _r.NextBytes(buffer); + } + public System.Net.IPAddress NextIPAddress() { - byte[] btarr = new byte[]{(byte)this.Next(0, 128), (byte)this.Next(0, 128), (byte)this.Next(0, 128), (byte)this.Next(0, 128)}; + byte[] btarr = new byte[]{(byte)this.Next(0, 128), (byte)this._r.Next(0, 128), (byte)this._r.Next(0, 128), (byte)this._r.Next(0, 128)}; return new System.Net.IPAddress(btarr); } diff --git a/src/Cassandra.Tests/Cassandra.Tests.csproj b/src/Cassandra.Tests/Cassandra.Tests.csproj index 4601e2ad4..f1cbfac70 100644 --- a/src/Cassandra.Tests/Cassandra.Tests.csproj +++ b/src/Cassandra.Tests/Cassandra.Tests.csproj @@ -1,9 +1,10 @@  - net48;net462;net472;net452;netcoreapp3.1;netcoreapp2.0;netcoreapp2.1 - net462;netcoreapp3.1 - netcoreapp2.1;netcoreapp3.1 - netcoreapp2.0 + net8;net7;net6;net481;net462;net472 + net481;net8 + net6 + net7 + net8 net462 true NU1901;NU1902;NU1903;NU1904 @@ -15,31 +16,23 @@ true 7.1 - + $(DefineConstants);NETFRAMEWORK - + $(DefineConstants);NETCOREAPP - + TargetFramework=net452 - + TargetFramework=net461 - - - TargetFramework=netstandard2.0 - - - TargetFramework=netstandard2.0 - - - + TargetFramework=netstandard2.0 @@ -52,20 +45,20 @@ - - + + - + - + - + diff --git a/src/Cassandra.Tests/TaskTests.cs b/src/Cassandra.Tests/TaskTests.cs index 724cfa975..bdde7a5e6 100644 --- a/src/Cassandra.Tests/TaskTests.cs +++ b/src/Cassandra.Tests/TaskTests.cs @@ -161,7 +161,7 @@ public void TaskHelper_TaskCompletionSourceWithTimeout_Does_Not_Invoke_Delegate_ [Test] public void ConfigureAwait_Used_For_Every_Awaited_Task() { - var assemblyFile = new FileInfo(new Uri(GetType().GetTypeInfo().Assembly.CodeBase).LocalPath); + var assemblyFile = new FileInfo(new Uri(GetType().GetTypeInfo().Assembly.Location).LocalPath); var directory = assemblyFile.Directory; while (directory != null && directory.Name != "src") { diff --git a/src/Cassandra/Cassandra.csproj b/src/Cassandra/Cassandra.csproj index 811bca93e..d82cf219d 100644 --- a/src/Cassandra/Cassandra.csproj +++ b/src/Cassandra/Cassandra.csproj @@ -4,8 +4,9 @@ Copyright © by DataStax DataStax C# Driver for Apache Cassandra 3.99.0.0 - 3.20.0.0 - 3.20.0 + 3.20.1.0 + 3.20.1 + false DataStax net452;netstandard2.0 netstandard2.0 @@ -25,11 +26,11 @@ https://github.com/datastax/csharp-driver 7.1 - + $(DefineConstants);NETFRAMEWORK - - $(DefineConstants);NETSTANDARD + + $(DefineConstants);NETCOREAPP @@ -40,7 +41,7 @@ - + diff --git a/src/Cassandra/Data/Linq/CqlFunction.cs b/src/Cassandra/Data/Linq/CqlFunction.cs index 6041db9f5..1d8836fc6 100644 --- a/src/Cassandra/Data/Linq/CqlFunction.cs +++ b/src/Cassandra/Data/Linq/CqlFunction.cs @@ -175,7 +175,26 @@ public static CqlFunction Token(object key1, object key2, object key3, object ke { throw new InvalidOperationException(); } - + public static bool operator ==(CqlFunction a, Guid b) + { + throw new InvalidOperationException(); + } + + public static bool operator ==(Guid b, CqlFunction a) + { + throw new InvalidOperationException(); + } + + public static bool operator !=(CqlFunction a, Guid b) + { + throw new InvalidOperationException(); + } + + public static bool operator !=(Guid b, CqlFunction a) + { + throw new InvalidOperationException(); + } + public static bool operator <=(CqlFunction a, Guid b) { throw new InvalidOperationException(); diff --git a/src/Extensions/Cassandra.AppMetrics/Cassandra.AppMetrics.csproj b/src/Extensions/Cassandra.AppMetrics/Cassandra.AppMetrics.csproj index c4f359994..9f67d81fe 100644 --- a/src/Extensions/Cassandra.AppMetrics/Cassandra.AppMetrics.csproj +++ b/src/Extensions/Cassandra.AppMetrics/Cassandra.AppMetrics.csproj @@ -4,8 +4,8 @@ This package builds on the DataStax Enterprise C# driver and DataStax C# Driver for Apache Cassandra, adding a metrics provider implementation using App Metrics. Copyright © by DataStax 3.99.0.0 - 3.20.0.0 - 3.20.0 + 3.20.1.0 + 3.20.1 DataStax netstandard2.0;net461 netstandard2.0