diff --git a/Directory.Packages.props b/Directory.Packages.props index 9767a0ab1..4f65bb324 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,9 +1,9 @@ - - - + + + diff --git a/src/StackExchange.Redis/TextWriterLogger.cs b/src/StackExchange.Redis/TextWriterLogger.cs index 4d8507b95..e2514118e 100644 --- a/src/StackExchange.Redis/TextWriterLogger.cs +++ b/src/StackExchange.Redis/TextWriterLogger.cs @@ -17,11 +17,7 @@ public TextWriterLogger(TextWriter writer, ILogger? wrapped) _wrapped = wrapped; } -#if NET8_0_OR_GREATER public IDisposable? BeginScope(TState state) where TState : notnull => NothingDisposable.Instance; -#else - public IDisposable BeginScope(TState state) => NothingDisposable.Instance; -#endif public bool IsEnabled(LogLevel logLevel) => _writer is not null || _wrapped is not null; public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) diff --git a/tests/StackExchange.Redis.Tests/LoggerTests.cs b/tests/StackExchange.Redis.Tests/LoggerTests.cs index 682856baa..6c126f5af 100644 --- a/tests/StackExchange.Redis.Tests/LoggerTests.cs +++ b/tests/StackExchange.Redis.Tests/LoggerTests.cs @@ -62,11 +62,7 @@ public class TestWrapperLogger(ILogger toWrap) : ILogger public int LogCount = 0; private ILogger Inner { get; } = toWrap; -#if NET8_0_OR_GREATER public IDisposable? BeginScope(TState state) where TState : notnull => Inner.BeginScope(state); -#else - public IDisposable BeginScope(TState state) => Inner.BeginScope(state); -#endif public bool IsEnabled(LogLevel logLevel) => Inner.IsEnabled(logLevel); public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) { @@ -80,11 +76,7 @@ public void Log(LogLevel logLevel, EventId eventId, TState state, Except /// private sealed class TestMultiLogger(params ILogger[] loggers) : ILogger { -#if NET8_0_OR_GREATER public IDisposable? BeginScope(TState state) where TState : notnull => null; -#else - public IDisposable BeginScope(TState state) => null!; -#endif public bool IsEnabled(LogLevel logLevel) => true; public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) { @@ -104,11 +96,7 @@ private sealed class TestLogger : ILogger public TestLogger(LogLevel logLevel, TextWriter output) => (_logLevel, _output) = (logLevel, output); -#if NET8_0_OR_GREATER public IDisposable? BeginScope(TState state) where TState : notnull => null; -#else - public IDisposable BeginScope(TState state) => null!; -#endif public bool IsEnabled(LogLevel logLevel) => logLevel >= _logLevel; public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) {