diff --git a/Directory.Packages.props b/Directory.Packages.props
index c8a4189e6..12097728a 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -1,7 +1,8 @@
-
+
+
@@ -9,22 +10,23 @@
-
+
-
-
-
+
+
-
+
-
+
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/StackExchange.Redis/ConfigurationOptions.cs b/src/StackExchange.Redis/ConfigurationOptions.cs
index e972962b2..199f1a378 100644
--- a/src/StackExchange.Redis/ConfigurationOptions.cs
+++ b/src/StackExchange.Redis/ConfigurationOptions.cs
@@ -357,13 +357,17 @@ private static bool CheckTrustedIssuer(X509Certificate2 certificateToValidate, X
byte[] authorityData = authority.RawData;
foreach (var chainElement in chain.ChainElements)
{
-#if NET8_0_OR_GREATER
-#error TODO: use RawDataMemory (needs testing)
-#endif
using var chainCert = chainElement.Certificate;
- if (!found && chainCert.RawData.SequenceEqual(authorityData))
+ if (!found)
{
- found = true;
+#if NET8_0_OR_GREATER
+ if (chainCert.RawDataMemory.Span.SequenceEqual(authorityData))
+#else
+ if (chainCert.RawData.SequenceEqual(authorityData))
+#endif
+ {
+ found = true;
+ }
}
}
return found;
diff --git a/src/StackExchange.Redis/Enums/CommandFlags.cs b/src/StackExchange.Redis/Enums/CommandFlags.cs
index bafaee70f..83331a3c5 100644
--- a/src/StackExchange.Redis/Enums/CommandFlags.cs
+++ b/src/StackExchange.Redis/Enums/CommandFlags.cs
@@ -34,11 +34,22 @@ public enum CommandFlags
///
PreferMaster = 0,
+#if NET8_0_OR_GREATER
+ ///
+ /// This operation should be performed on the replica if it is available, but will be performed on
+ /// a primary if no replicas are available. Suitable for read operations only.
+ ///
+ [Obsolete("Starting with Redis version 5, Redis has moved to 'replica' terminology. Please use " + nameof(PreferReplica) + " instead, this will be removed in 3.0.")]
+ [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
+ PreferSlave = 8,
+#endif
+
///
/// This operation should only be performed on the primary.
///
DemandMaster = 4,
+#if !NET8_0_OR_GREATER
///
/// This operation should be performed on the replica if it is available, but will be performed on
/// a primary if no replicas are available. Suitable for read operations only.
@@ -46,6 +57,7 @@ public enum CommandFlags
[Obsolete("Starting with Redis version 5, Redis has moved to 'replica' terminology. Please use " + nameof(PreferReplica) + " instead, this will be removed in 3.0.")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
PreferSlave = 8,
+#endif
///
/// This operation should be performed on the replica if it is available, but will be performed on
@@ -53,17 +65,28 @@ public enum CommandFlags
///
PreferReplica = 8, // note: we're using a 2-bit set here, which [Flags] formatting hates; position is doing the best we can for reasonable outcomes here
+#if NET8_0_OR_GREATER
+ ///
+ /// This operation should only be performed on a replica. Suitable for read operations only.
+ ///
+ [Obsolete("Starting with Redis version 5, Redis has moved to 'replica' terminology. Please use " + nameof(DemandReplica) + " instead, this will be removed in 3.0.")]
+ [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
+ DemandSlave = 12,
+#endif
+
///
/// This operation should only be performed on a replica. Suitable for read operations only.
///
DemandReplica = 12, // note: we're using a 2-bit set here, which [Flags] formatting hates; position is doing the best we can for reasonable outcomes here
+#if !NET8_0_OR_GREATER
///
/// This operation should only be performed on a replica. Suitable for read operations only.
///
[Obsolete("Starting with Redis version 5, Redis has moved to 'replica' terminology. Please use " + nameof(DemandReplica) + " instead, this will be removed in 3.0.")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
DemandSlave = 12,
+#endif
// 16: reserved for additional "demand/prefer" options
diff --git a/src/StackExchange.Redis/Exceptions.cs b/src/StackExchange.Redis/Exceptions.cs
index 9315eb806..1f1c973ce 100644
--- a/src/StackExchange.Redis/Exceptions.cs
+++ b/src/StackExchange.Redis/Exceptions.cs
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
using System.Runtime.Serialization;
namespace StackExchange.Redis
@@ -22,6 +23,10 @@ public RedisCommandException(string message) : base(message) { }
/// The inner exception.
public RedisCommandException(string message, Exception innerException) : base(message, innerException) { }
+#if NET8_0_OR_GREATER
+ [Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
private RedisCommandException(SerializationInfo info, StreamingContext ctx) : base(info, ctx) { }
}
@@ -46,6 +51,10 @@ public RedisTimeoutException(string message, CommandStatus commandStatus) : base
///
public CommandStatus Commandstatus { get; }
+#if NET8_0_OR_GREATER
+ [Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
private RedisTimeoutException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
{
Commandstatus = info.GetValue("commandStatus", typeof(CommandStatus)) as CommandStatus? ?? CommandStatus.Unknown;
@@ -56,6 +65,10 @@ private RedisTimeoutException(SerializationInfo info, StreamingContext ctx) : ba
///
/// Serialization info.
/// Serialization context.
+#if NET8_0_OR_GREATER
+ [Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
@@ -107,6 +120,10 @@ public RedisConnectionException(ConnectionFailureType failureType, string messag
///
public CommandStatus CommandStatus { get; }
+#if NET8_0_OR_GREATER
+ [Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
private RedisConnectionException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
{
FailureType = (ConnectionFailureType)info.GetInt32("failureType");
@@ -118,6 +135,10 @@ private RedisConnectionException(SerializationInfo info, StreamingContext ctx) :
///
/// Serialization info.
/// Serialization context.
+#if NET8_0_OR_GREATER
+ [Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
@@ -150,6 +171,10 @@ public RedisException(string message, Exception? innerException) : base(message,
///
/// Serialization info.
/// Serialization context.
+#if NET8_0_OR_GREATER
+ [Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
protected RedisException(SerializationInfo info, StreamingContext ctx) : base(info, ctx) { }
}
@@ -165,6 +190,10 @@ public sealed partial class RedisServerException : RedisException
/// The message for the exception.
public RedisServerException(string message) : base(message) { }
+#if NET8_0_OR_GREATER
+ [Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
private RedisServerException(SerializationInfo info, StreamingContext ctx) : base(info, ctx) { }
}
}
diff --git a/src/StackExchange.Redis/Obsoletions.cs b/src/StackExchange.Redis/Obsoletions.cs
new file mode 100644
index 000000000..44ede249b
--- /dev/null
+++ b/src/StackExchange.Redis/Obsoletions.cs
@@ -0,0 +1,7 @@
+namespace StackExchange.Redis;
+
+internal static class Obsoletions
+{
+ public const string LegacyFormatterImplMessage = "This API supports obsolete formatter-based serialization. It should not be called or extended by application code.";
+ public const string LegacyFormatterImplDiagId = "SYSLIB0051";
+}
diff --git a/src/StackExchange.Redis/PublicAPI/net8.0/PublicAPI.Shipped.txt b/src/StackExchange.Redis/PublicAPI/net8.0/PublicAPI.Shipped.txt
new file mode 100644
index 000000000..599891ac2
--- /dev/null
+++ b/src/StackExchange.Redis/PublicAPI/net8.0/PublicAPI.Shipped.txt
@@ -0,0 +1,3 @@
+StackExchange.Redis.ConfigurationOptions.SslClientAuthenticationOptions.get -> System.Func?
+StackExchange.Redis.ConfigurationOptions.SslClientAuthenticationOptions.set -> void
+System.Runtime.CompilerServices.IsExternalInit (forwarded, contained in System.Runtime)
\ No newline at end of file
diff --git a/src/StackExchange.Redis/StackExchange.Redis.csproj b/src/StackExchange.Redis/StackExchange.Redis.csproj
index ba7c31c35..53b1542c3 100644
--- a/src/StackExchange.Redis/StackExchange.Redis.csproj
+++ b/src/StackExchange.Redis/StackExchange.Redis.csproj
@@ -2,7 +2,7 @@
enable
- net461;netstandard2.0;net472;netcoreapp3.1;net6.0
+ net461;netstandard2.0;net472;netcoreapp3.1;net6.0;net8.0
High performance Redis client, incorporating both synchronous and asynchronous usage.
StackExchange.Redis
StackExchange.Redis
diff --git a/tests/BasicTest/BasicTest.csproj b/tests/BasicTest/BasicTest.csproj
index 7fcf776ee..593d26619 100644
--- a/tests/BasicTest/BasicTest.csproj
+++ b/tests/BasicTest/BasicTest.csproj
@@ -2,7 +2,7 @@
StackExchange.Redis.BasicTest .NET Core
- net472;net6.0
+ net472;net8.0
BasicTest
Exe
BasicTest
@@ -11,6 +11,9 @@
+
+
+
diff --git a/tests/BasicTestBaseline/BasicTestBaseline.csproj b/tests/BasicTestBaseline/BasicTestBaseline.csproj
index f396ae7c1..a9f75e441 100644
--- a/tests/BasicTestBaseline/BasicTestBaseline.csproj
+++ b/tests/BasicTestBaseline/BasicTestBaseline.csproj
@@ -2,7 +2,7 @@
StackExchange.Redis.BasicTest .NET Core
- net472;net6.0
+ net472;net8.0
BasicTestBaseline
Exe
BasicTestBaseline
@@ -17,6 +17,8 @@
+
+
diff --git a/tests/ConsoleTest/ConsoleTest.csproj b/tests/ConsoleTest/ConsoleTest.csproj
index 883ab204a..b3c1fd998 100644
--- a/tests/ConsoleTest/ConsoleTest.csproj
+++ b/tests/ConsoleTest/ConsoleTest.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
Exe
enable
enable
diff --git a/tests/ConsoleTestBaseline/ConsoleTestBaseline.csproj b/tests/ConsoleTestBaseline/ConsoleTestBaseline.csproj
index 2c4bac2f5..1a6a7149d 100644
--- a/tests/ConsoleTestBaseline/ConsoleTestBaseline.csproj
+++ b/tests/ConsoleTestBaseline/ConsoleTestBaseline.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
Exe
enable
enable
diff --git a/tests/StackExchange.Redis.Tests/ConfigTests.cs b/tests/StackExchange.Redis.Tests/ConfigTests.cs
index 4db6b1163..c8a5eacd6 100644
--- a/tests/StackExchange.Redis.Tests/ConfigTests.cs
+++ b/tests/StackExchange.Redis.Tests/ConfigTests.cs
@@ -92,15 +92,15 @@ public void ExpectedFields()
[Fact]
public void SslProtocols_SingleValue()
{
- var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls11");
- Assert.Equal(SslProtocols.Tls11, options.SslProtocols.GetValueOrDefault());
+ var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls12");
+ Assert.Equal(SslProtocols.Tls12, options.SslProtocols.GetValueOrDefault());
}
[Fact]
public void SslProtocols_MultipleValues()
{
- var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls11|Tls12");
- Assert.Equal(SslProtocols.Tls11 | SslProtocols.Tls12, options.SslProtocols.GetValueOrDefault());
+ var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls12|Tls13");
+ Assert.Equal(SslProtocols.Tls12 | SslProtocols.Tls13, options.SslProtocols.GetValueOrDefault());
}
[Theory]
@@ -121,9 +121,9 @@ public void SslProtocols_UsingIntegerValue()
// The below scenario is for cases where the *targeted*
// .NET framework version (e.g. .NET 4.0) doesn't define an enum value (e.g. Tls11)
// but the OS has been patched with support
- const int integerValue = (int)(SslProtocols.Tls11 | SslProtocols.Tls12);
+ const int integerValue = (int)(SslProtocols.Tls12 | SslProtocols.Tls13);
var options = ConfigurationOptions.Parse("myhost,sslProtocols=" + integerValue);
- Assert.Equal(SslProtocols.Tls11 | SslProtocols.Tls12, options.SslProtocols.GetValueOrDefault());
+ Assert.Equal(SslProtocols.Tls12 | SslProtocols.Tls13, options.SslProtocols.GetValueOrDefault());
}
[Fact]
@@ -203,7 +203,7 @@ public void ConfigurationOptionsIPv6Parsing(string configString, AddressFamily f
public void CanParseAndFormatUnixDomainSocket()
{
const string ConfigString = "!/some/path,allowAdmin=True";
-#if NET472
+#if NETFRAMEWORK
var ex = Assert.Throws(() => ConfigurationOptions.Parse(ConfigString));
Assert.Equal("Unix domain sockets require .NET Core 3 or above", ex.Message);
#else
@@ -793,6 +793,6 @@ public void CheckHighIntegrity(bool? assigned, bool expected, string cs)
Assert.Equal(cs, clone.ToString());
var parsed = ConfigurationOptions.Parse(cs);
- Assert.Equal(expected, options.HighIntegrity);
+ Assert.Equal(expected, parsed.HighIntegrity);
}
}
diff --git a/tests/StackExchange.Redis.Tests/FormatTests.cs b/tests/StackExchange.Redis.Tests/FormatTests.cs
index cf7593a08..9356c2e31 100644
--- a/tests/StackExchange.Redis.Tests/FormatTests.cs
+++ b/tests/StackExchange.Redis.Tests/FormatTests.cs
@@ -55,15 +55,21 @@ public void ParseEndPoint(string data, EndPoint expected, string? expectedFormat
[Theory]
[InlineData(CommandFlags.None, "None")]
-#if NET472
+#if NETFRAMEWORK
[InlineData(CommandFlags.PreferReplica, "PreferMaster, PreferReplica")] // 2-bit flag is hit-and-miss
[InlineData(CommandFlags.DemandReplica, "PreferMaster, DemandReplica")] // 2-bit flag is hit-and-miss
#else
[InlineData(CommandFlags.PreferReplica, "PreferReplica")] // 2-bit flag is hit-and-miss
[InlineData(CommandFlags.DemandReplica, "DemandReplica")] // 2-bit flag is hit-and-miss
#endif
+
+#if NET8_0_OR_GREATER
+ [InlineData(CommandFlags.PreferReplica | CommandFlags.FireAndForget, "FireAndForget, PreferReplica")] // 2-bit flag is hit-and-miss
+ [InlineData(CommandFlags.DemandReplica | CommandFlags.FireAndForget, "FireAndForget, DemandReplica")] // 2-bit flag is hit-and-miss
+#else
[InlineData(CommandFlags.PreferReplica | CommandFlags.FireAndForget, "PreferMaster, FireAndForget, PreferReplica")] // 2-bit flag is hit-and-miss
[InlineData(CommandFlags.DemandReplica | CommandFlags.FireAndForget, "PreferMaster, FireAndForget, DemandReplica")] // 2-bit flag is hit-and-miss
+#endif
public void CommandFlagsFormatting(CommandFlags value, string expected)
=> Assert.Equal(expected, value.ToString());
diff --git a/tests/StackExchange.Redis.Tests/SSLTests.cs b/tests/StackExchange.Redis.Tests/SSLTests.cs
index 2a261fe1a..5b11f68c8 100644
--- a/tests/StackExchange.Redis.Tests/SSLTests.cs
+++ b/tests/StackExchange.Redis.Tests/SSLTests.cs
@@ -7,10 +7,12 @@
using System.Net;
using System.Net.Security;
using System.Reflection;
+using System.Runtime.InteropServices;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
+using NSubstitute.Exceptions;
using StackExchange.Redis.Tests.Helpers;
using Xunit;
using Xunit.Abstractions;
@@ -182,34 +184,35 @@ public async Task ConnectToSSLServer(bool useSsl, bool specifyHost)
[InlineData(SslProtocols.Ssl3 | SslProtocols.Tls12 | SslProtocols.Tls13, true)]
[InlineData(SslProtocols.Ssl2, false, TlsCipherSuite.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TlsCipherSuite.TLS_AES_256_GCM_SHA384)]
#pragma warning restore CS0618 // Type or member is obsolete
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "Yes, we know.")]
public async Task ConnectSslClientAuthenticationOptions(SslProtocols protocols, bool expectSuccess, params TlsCipherSuite[] tlsCipherSuites)
{
Fixture.SkipIfNoServer();
- var config = new ConfigurationOptions()
+ try
{
- EndPoints = { TestConfig.Current.SslServerAndPort },
- AllowAdmin = true,
- ConnectRetry = 1,
- SyncTimeout = Debugger.IsAttached ? int.MaxValue : 5000,
- Ssl = true,
- SslClientAuthenticationOptions = host => new SslClientAuthenticationOptions()
+ var config = new ConfigurationOptions()
{
- TargetHost = host,
- CertificateRevocationCheckMode = X509RevocationMode.NoCheck,
- EnabledSslProtocols = protocols,
- CipherSuitesPolicy = tlsCipherSuites?.Length > 0 ? new CipherSuitesPolicy(tlsCipherSuites) : null,
- RemoteCertificateValidationCallback = (sender, cert, chain, errors) =>
+ EndPoints = { TestConfig.Current.SslServerAndPort },
+ AllowAdmin = true,
+ ConnectRetry = 1,
+ SyncTimeout = Debugger.IsAttached ? int.MaxValue : 5000,
+ Ssl = true,
+ SslClientAuthenticationOptions = host => new SslClientAuthenticationOptions()
{
- Log(" Errors: " + errors);
- Log(" Cert issued to: " + cert?.Subject);
- return true;
+ TargetHost = host,
+ CertificateRevocationCheckMode = X509RevocationMode.NoCheck,
+ EnabledSslProtocols = protocols,
+ CipherSuitesPolicy = tlsCipherSuites?.Length > 0 ? new CipherSuitesPolicy(tlsCipherSuites) : null,
+ RemoteCertificateValidationCallback = (sender, cert, chain, errors) =>
+ {
+ Log(" Errors: " + errors);
+ Log(" Cert issued to: " + cert?.Subject);
+ return true;
+ },
},
- },
- };
+ };
- try
- {
if (expectSuccess)
{
using var conn = await ConnectionMultiplexer.ConnectAsync(config, Writer);
@@ -376,12 +379,12 @@ public void SSLHostInferredFromEndpoints()
},
Ssl = true,
};
- Assert.True(options.SslHost == "mycache.rediscache.windows.net");
+ Assert.Equal("mycache.rediscache.windows.net", options.SslHost);
options = new ConfigurationOptions()
{
EndPoints = { { "121.23.23.45", 15000 } },
};
- Assert.True(options.SslHost == null);
+ Assert.Null(options.SslHost);
}
private void Check(string name, object? x, object? y)
@@ -528,7 +531,7 @@ public void SSLParseViaConfig_Issue883_ConfigString()
[Fact]
public void ConfigObject_Issue1407_ToStringIncludesSslProtocols()
{
- const SslProtocols sslProtocols = SslProtocols.Tls12 | SslProtocols.Tls;
+ const SslProtocols sslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13;
var sourceOptions = new ConfigurationOptions
{
AbortOnConnectFail = false,
diff --git a/tests/StackExchange.Redis.Tests/ServerSnapshotTests.cs b/tests/StackExchange.Redis.Tests/ServerSnapshotTests.cs
index 241999533..2c81c3826 100644
--- a/tests/StackExchange.Redis.Tests/ServerSnapshotTests.cs
+++ b/tests/StackExchange.Redis.Tests/ServerSnapshotTests.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.Serialization;
using Xunit;
@@ -9,9 +10,11 @@ namespace StackExchange.Redis.Tests;
public class ServerSnapshotTests
{
[Fact]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2012:Do not use boolean check to check if a value exists in a collection", Justification = "Explicit testing")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2013:Do not use equality check to check for collection size.", Justification = "Explicit testing")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2029:Do not use Empty() to check if a value does not exist in a collection", Justification = "Explicit testing")]
+ [SuppressMessage("Assertions", "xUnit2012:Do not use boolean check to check if a value exists in a collection", Justification = "Explicit testing")]
+ [SuppressMessage("Assertions", "xUnit2013:Do not use equality check to check for collection size.", Justification = "Explicit testing")]
+ [SuppressMessage("Assertions", "xUnit2029:Do not use Empty() to check if a value does not exist in a collection", Justification = "Explicit testing")]
+ [SuppressMessage("Performance", "CA1829:Use Length/Count property instead of Count() when available", Justification = "Explicit testing")]
+ [SuppressMessage("Performance", "CA1860:Avoid using 'Enumerable.Any()' extension method", Justification = "Explicit testing")]
public void EmptyBehaviour()
{
var snapshot = ServerSnapshot.Empty;
@@ -52,14 +55,19 @@ public void EmptyBehaviour()
[InlineData(5, 0)]
[InlineData(5, 3)]
[InlineData(5, 5)]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2012:Do not use boolean check to check if a value exists in a collection", Justification = "Explicit testing")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2029:Do not use Empty() to check if a value does not exist in a collection", Justification = "Explicit testing")]
+ [SuppressMessage("Assertions", "xUnit2012:Do not use boolean check to check if a value exists in a collection", Justification = "Explicit testing")]
+ [SuppressMessage("Assertions", "xUnit2029:Do not use Empty() to check if a value does not exist in a collection", Justification = "Explicit testing")]
+ [SuppressMessage("Assertions", "xUnit2030:Do not use Assert.NotEmpty to check if a value exists in a collection", Justification = "Explicit testing")]
+ [SuppressMessage("Performance", "CA1829:Use Length/Count property instead of Count() when available", Justification = "Explicit testing")]
+ [SuppressMessage("Performance", "CA1860:Avoid using 'Enumerable.Any()' extension method", Justification = "Explicit testing")]
public void NonEmptyBehaviour(int count, int replicaCount)
{
var snapshot = ServerSnapshot.Empty;
for (int i = 0; i < count; i++)
{
+#pragma warning disable SYSLIB0050 // Type or member is obsolete
var dummy = (ServerEndPoint)FormatterServices.GetSafeUninitializedObject(typeof(ServerEndPoint));
+#pragma warning restore SYSLIB0050 // Type or member is obsolete
dummy.IsReplica = i < replicaCount;
snapshot = snapshot.Add(dummy);
}
diff --git a/tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj b/tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
index 4e354b846..80a5762cf 100644
--- a/tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
+++ b/tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
@@ -1,6 +1,6 @@
- net472;net6.0
+ net481;net8.0
StackExchange.Redis.Tests
true
true
diff --git a/toys/TestConsole/TestConsole.csproj b/toys/TestConsole/TestConsole.csproj
index 71bc9fe63..674ec5cfe 100644
--- a/toys/TestConsole/TestConsole.csproj
+++ b/toys/TestConsole/TestConsole.csproj
@@ -2,7 +2,7 @@
Exe
- net6.0;net472
+ net8.0;net472
SEV2
true
diff --git a/toys/TestConsoleBaseline/TestConsoleBaseline.csproj b/toys/TestConsoleBaseline/TestConsoleBaseline.csproj
index c2d46d20a..10d5ab321 100644
--- a/toys/TestConsoleBaseline/TestConsoleBaseline.csproj
+++ b/toys/TestConsoleBaseline/TestConsoleBaseline.csproj
@@ -2,7 +2,7 @@
Exe
- net6.0;net461;net462;net47;net472
+ net8.0;net461;net462;net47;net472