diff --git a/Directory.Packages.props b/Directory.Packages.props index f886355373b..536b384f784 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,8 +1,9 @@ - 8.0.0 true - 8.3.0 + 8.3.1 + 8.0.0 + 8.4.0 @@ -22,7 +23,7 @@ - + diff --git a/src/Polly.Core/Polly.Core.csproj b/src/Polly.Core/Polly.Core.csproj index dc559e6103f..87d5cf5f18d 100644 --- a/src/Polly.Core/Polly.Core.csproj +++ b/src/Polly.Core/Polly.Core.csproj @@ -11,12 +11,8 @@ true true - - true - true - true + true - true diff --git a/src/Polly.Core/Utils/TypeNameFormatter.cs b/src/Polly.Core/Utils/TypeNameFormatter.cs index 57cc143a602..00fe18faf14 100644 --- a/src/Polly.Core/Utils/TypeNameFormatter.cs +++ b/src/Polly.Core/Utils/TypeNameFormatter.cs @@ -17,6 +17,12 @@ public static string Format(Type type) return type.Name; } - return $"{type.Name.Substring(0, type.Name.Length - GenericSuffixLength)}<{Format(args[0])}>"; +#if NET6_0_OR_GREATER + var nameNoAirity = type.Name[..(type.Name.Length - GenericSuffixLength)]; +#else + var nameNoAirity = type.Name.Substring(0, type.Name.Length - GenericSuffixLength); +#endif + + return $"{nameNoAirity}<{Format(args[0])}>"; } } diff --git a/src/Polly.Extensions/Polly.Extensions.csproj b/src/Polly.Extensions/Polly.Extensions.csproj index 2b752a541ae..25ff0fd719f 100644 --- a/src/Polly.Extensions/Polly.Extensions.csproj +++ b/src/Polly.Extensions/Polly.Extensions.csproj @@ -9,12 +9,8 @@ 100 true - - true - true - true + true - true diff --git a/src/Polly.RateLimiting/Polly.RateLimiting.csproj b/src/Polly.RateLimiting/Polly.RateLimiting.csproj index f06c8a674a1..789946e976c 100644 --- a/src/Polly.RateLimiting/Polly.RateLimiting.csproj +++ b/src/Polly.RateLimiting/Polly.RateLimiting.csproj @@ -9,12 +9,8 @@ 100 true - - true - true - true + true - true diff --git a/src/Polly/Utilities/KeyHelper.cs b/src/Polly/Utilities/KeyHelper.cs index fc92a4027f8..9b2f21e771f 100644 --- a/src/Polly/Utilities/KeyHelper.cs +++ b/src/Polly/Utilities/KeyHelper.cs @@ -6,5 +6,9 @@ internal static class KeyHelper private const int GuidPartLength = 8; public static string GuidPart() => +#if NET6_0_OR_GREATER + Guid.NewGuid().ToString()[..GuidPartLength]; +#else Guid.NewGuid().ToString().Substring(0, GuidPartLength); +#endif } diff --git a/test/Polly.Core.Tests/Hedging/Controller/HedgingExecutionContextTests.cs b/test/Polly.Core.Tests/Hedging/Controller/HedgingExecutionContextTests.cs index 7058e1fca60..cba6da27d9d 100644 --- a/test/Polly.Core.Tests/Hedging/Controller/HedgingExecutionContextTests.cs +++ b/test/Polly.Core.Tests/Hedging/Controller/HedgingExecutionContextTests.cs @@ -141,7 +141,9 @@ public async Task TryWaitForCompletedExecutionAsync_SynchronousExecution_Ok() } var task = context.TryWaitForCompletedExecutionAsync(System.Threading.Timeout.InfiniteTimeSpan).AsTask(); +#pragma warning disable xUnit1031 // Do not use blocking task operations in test method task.Wait(20).Should().BeFalse(); +#pragma warning restore xUnit1031 // Do not use blocking task operations in test method _timeProvider.Advance(TimeSpan.FromDays(1)); await task; context.Tasks[0].AcceptOutcome(); @@ -162,7 +164,9 @@ public async Task TryWaitForCompletedExecutionAsync_HedgedExecution_Ok() var hedgingDelay = TimeSpan.FromSeconds(5); var count = _timeProvider.TimerEntries.Count; var task = context.TryWaitForCompletedExecutionAsync(hedgingDelay).AsTask(); +#pragma warning disable xUnit1031 // Do not use blocking task operations in test method task.Wait(20).Should().BeFalse(); +#pragma warning restore xUnit1031 // Do not use blocking task operations in test method _timeProvider.TimerEntries.Should().HaveCount(count + 1); _timeProvider.TimerEntries.Last().Delay.Should().Be(hedgingDelay); _timeProvider.Advance(TimeSpan.FromDays(1)); @@ -382,7 +386,9 @@ public async Task Complete_EnsurePendingTasksCleaned() await context.TryWaitForCompletedExecutionAsync(System.Threading.Timeout.InfiniteTimeSpan); var pending = context.Tasks[1].ExecutionTaskSafe!; +#pragma warning disable xUnit1031 // Do not use blocking task operations in test method pending.Wait(10).Should().BeFalse(); +#pragma warning restore xUnit1031 // Do not use blocking task operations in test method context.Tasks[0].AcceptOutcome(); await context.DisposeAsync(); diff --git a/test/Polly.Core.Tests/Polly.Core.Tests.csproj b/test/Polly.Core.Tests/Polly.Core.Tests.csproj index b982b9b6add..49fd0884d98 100644 --- a/test/Polly.Core.Tests/Polly.Core.Tests.csproj +++ b/test/Polly.Core.Tests/Polly.Core.Tests.csproj @@ -11,6 +11,7 @@ + diff --git a/test/Polly.Core.Tests/Simmy/ChaosStrategyConstantsTests.cs b/test/Polly.Core.Tests/Simmy/ChaosStrategyConstantsTests.cs index f180b7a21c7..5eb79df0572 100644 --- a/test/Polly.Core.Tests/Simmy/ChaosStrategyConstantsTests.cs +++ b/test/Polly.Core.Tests/Simmy/ChaosStrategyConstantsTests.cs @@ -1,5 +1,7 @@ using Polly.Simmy; +namespace Polly.Core.Tests; + public class ChaosStrategyConstantsTests { [Fact]