diff --git a/CHANGELOG.md b/CHANGELOG.md index f9b76177854..728df487dd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 6.0.1 +- Version 6 RTM, for integration to ASPNET Core 2.1 IHttpClientFactory + +## 6.0.0-v6alpha +- Publish as strong-named package only (discontinue non-strong-named versions) +- Add .NetStandard 2.0 tfm +- Provide .NET4.5 support via .NetStandard 1.1 tfm +- Discontinue .NET4.0 support +- Remove methods marked as deprecated in v5.9.0 + ## 5.9.0 - Allow Timeout.InfiniteTimeSpan (no timeout) for TimeoutPolicy. - Add .AsPolicy<TResult> and .AsAsyncPolicy<TResult> methods for converting non-generic policies to generic policies. diff --git a/GitVersionConfig.yaml b/GitVersionConfig.yaml index a98198e3a33..67f30281d5d 100644 --- a/GitVersionConfig.yaml +++ b/GitVersionConfig.yaml @@ -1 +1 @@ -next-version: 5.9.0 \ No newline at end of file +next-version: 6.0.1 \ No newline at end of file diff --git a/README.md b/README.md index be7cffd50fd..f5947d2a301 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. -Polly targets .NET 4.0, .NET 4.5 and .NET Standard 1.1 ([coverage](https://github.com/dotnet/standard/blob/master/docs/versions.md): .NET Core, Mono, Xamarin.iOS, Xamarin.Android, UWP, WP8.1+). +Polly targets .NET Standard 1.1 ([coverage](https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support): .NET Framework 4.5-4.6.1, .NET Core 1.0, Mono, Xamarin, UWP, WP8.1+) and .NET Standard 2.0+ ([coverage](https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support): .NET Framework 4.6.1, .NET Core 2.0+, and later Mono, Xamarin and UWP targets). [](https://www.dotnetfoundation.org/) -We are now a member of the [.NET Foundation](https://www.dotnetfoundation.org/about)! +We are a member of the [.NET Foundation](https://www.dotnetfoundation.org/about)! **Keep up to date with new feature announcements, tips & tricks, and other news through [www.thepollyproject.org](http://www.thepollyproject.org)** @@ -17,15 +17,6 @@ We are now a member of the [.NET Foundation](https://www.dotnetfoundation.org/ab Install-Package Polly -You can install the Strongly Named version via: - - Install-Package Polly-Signed - -.NET4.0 support is provided via the packages: - - Install-Package Polly.Net40Async - Install-Package Polly.Net40Async-Signed - # Resilience policies @@ -916,10 +907,15 @@ This allows collections of similar kinds of policy to be treated as one - for ex For more detail see: [Polly and interfaces](https://github.com/App-vNext/Polly/wiki/Polly-and-interfaces) on wiki. +# .NET4.5 support + +From Polly v6.0.0, .NET4.5 support is provided [via the .Net Standard 1.1 target](https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support). + +Polly versions up to [v5.9.0](https://www.nuget.org/packages/Polly/5.9.0) have direct target support for .NET Framework 4.5. # .NET4.0 support -The .NET4.0 package uses `Microsoft.Bcl.Async` to add async support. To minimise dependencies on the main Polly nuget package, the .NET4.0 version is available as separate Nuget packages `Polly.Net40Async` and `Polly.Net40Async-signed`. +The last version of Polly to support .NET4.0 is [v5.9.0](https://www.nuget.org/packages/Polly.Net40Async/5.9.0). The .NET4.0 package uses `Microsoft.Bcl.Async` to add async support. To minimise dependencies on the main Polly nuget package, the .NET4.0 version is available as separate Nuget packages `Polly.Net40Async` and `Polly.Net40Async-signed`. # .NET3.5 support @@ -934,9 +930,9 @@ For details of changes by release see the [change log](https://github.com/App-vN * [Fluent Assertions](https://github.com/fluentassertions/fluentassertions) - A set of .NET extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style test | [Apache License 2.0 (Apache)](https://github.com/dennisdoomen/fluentassertions/blob/develop/LICENSE) * [xUnit.net](https://github.com/xunit/xunit) - Free, open source, community-focused unit testing tool for the .NET Framework | [Apache License 2.0 (Apache)](https://github.com/xunit/xunit/blob/master/license.txt) * [Ian Griffith's TimedLock](http://www.interact-sw.co.uk/iangblog/2004/04/26/yetmoretimedlocking) -* [Steven van Deursen's ReadOnlyDictionary](http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=29) (until v5.0.6) -* [Stephen Cleary's AsyncEx library](https://github.com/StephenCleary/AsyncEx) for AsyncSemaphore (supports BulkheadAsync policy for .NET4.0 only) | [MIT license](https://github.com/StephenCleary/AsyncEx/blob/master/LICENSE) -* [@theraot](https://github.com/theraot)'s [ExceptionDispatchInfo implementation for .NET4.0](https://stackoverflow.com/a/31226509/) (supports Timeout policy for .NET4.0 only) including also a contribution by [@migueldeicaza](https://github.com/migueldeicaza) | Licensed under and distributed under [Creative Commons Attribution Share Alike license](https://creativecommons.org/licenses/by-sa/3.0/) per [StackExchange Terms of Service](https://stackexchange.com/legal) +* [Steven van Deursen's ReadOnlyDictionary](http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=29) (until Polly v5.0.6) +* [Stephen Cleary's AsyncEx library](https://github.com/StephenCleary/AsyncEx) for AsyncSemaphore (supports BulkheadAsync policy for .NET4.0 only) (until Polly v5.9.0) | [MIT license](https://github.com/StephenCleary/AsyncEx/blob/master/LICENSE) +* [@theraot](https://github.com/theraot)'s [ExceptionDispatchInfo implementation for .NET4.0](https://stackoverflow.com/a/31226509/) (supports Timeout policy for .NET4.0 only) (until Polly v5.9.0) including also a contribution by [@migueldeicaza](https://github.com/migueldeicaza) | Licensed under and distributed under [Creative Commons Attribution Share Alike license](https://creativecommons.org/licenses/by-sa/3.0/) per [StackExchange Terms of Service](https://stackexchange.com/legal) * Build powered by [Cake](http://cakebuild.net/) and [GitVersionTask](https://github.com/GitTools/GitVersion). # Acknowledgements @@ -993,6 +989,7 @@ For details of changes by release see the [change log](https://github.com/App-vN * [@erickhouse](https://github.com/erickhouse) - Add a new onBreak overload that provides the prior state on a transition to an open state. * [@benagain](https://github.com/benagain) - Bug fix: RelativeTtl in CachePolicy now always returns a ttl relative to time item is cached. * [@urig](https://github.com/urig) - Allow TimeoutPolicy to be configured with Timeout.InfiniteTimeSpan. +* [@reisenberger](https://github.com/reisenberger) - Integration with [IHttpClientFactory](https://github.com/aspnet/HttpClientFactory/) for ASPNET Core 2.1. # Sample Projects diff --git a/build.cake b/build.cake index 7c124a5df12..54da4066786 100644 --- a/build.cake +++ b/build.cake @@ -26,7 +26,6 @@ using System.Text.Json; /////////////////////////////////////////////////////////////////////////////// var projectName = "Polly"; -var net40AsyncProjectName = "Polly.Net40Async"; var keyName = "Polly.snk"; var solutions = GetFiles("./**/*.sln"); @@ -39,27 +38,26 @@ var testResultsDir = artifactsDir + Directory("test-results"); // NuGet var nuspecFilename = projectName + ".nuspec"; -var net40AsyncNuspecFilename = net40AsyncProjectName + ".nuspec"; var nuspecSrcFile = srcDir + File(nuspecFilename); var nuspecDestFile = buildDir + File(nuspecFilename); -var net40AsyncNuspecSrcFile = srcDir + File(net40AsyncNuspecFilename); -var net40AsyncNuspecDestFile = buildDir + Directory(net40AsyncProjectName) + File(net40AsyncNuspecFilename); var nupkgDestDir = artifactsDir + Directory("nuget-package"); var snkFile = srcDir + File(keyName); var projectToNugetFolderMap = new Dictionary() { - { "Net45" , new [] {"net45"} }, { "NetStandard11", new [] {"netstandard1.1"} }, -}; - -var net40AsyncProjectToNugetFolderMap = new Dictionary() { - { "Net40Async" , new [] {"net40"} }, + { "NetStandard20", new [] {"netstandard2.0"} }, }; // Gitversion var gitVersionPath = ToolsExePath("GitVersion.exe"); Dictionary gitVersionOutput; +// Versioning +string nugetVersion; +string appveyorBuildNumber; +string assemblyVersion; +string assemblySemver; + // StrongNameSigner var strongNameSignerPath = ToolsExePath("StrongNameSigner.Console.exe"); @@ -134,31 +132,62 @@ Task("__UpdateAssemblyVersionInformation") gitVersionOutput = new JsonParser().Parse>(output); Information("Updated GlobalAssemblyInfo"); - Information("AssemblyVersion -> {0}", gitVersionOutput["AssemblySemVer"]); - Information("AssemblyFileVersion -> {0}", gitVersionOutput["MajorMinorPatch"]); - Information("AssemblyInformationalVersion -> {0}", gitVersionOutput["InformationalVersion"]); + + Information(""); + Information("Obtained raw version info for package versioning:"); + Information("NuGetVersion -> {0}", gitVersionOutput["NuGetVersion"]); + Information("FullSemVer -> {0}", gitVersionOutput["FullSemVer"]); + Information("AssemblySemVer -> {0}", gitVersionOutput["AssemblySemVer"]); + + appveyorBuildNumber = gitVersionOutput["FullSemVer"].ToString(); + nugetVersion = gitVersionOutput["NuGetVersion"].ToString(); + assemblyVersion = gitVersionOutput["Major"].ToString() + ".0.0.0"; + assemblySemver = gitVersionOutput["AssemblySemVer"].ToString(); + + Information(""); + Information("Mapping versioning information to:"); + Information("Appveyor build number -> {0}", appveyorBuildNumber); + Information("Nuget package version -> {0}", nugetVersion); + Information("AssemblyVersion -> {0}", assemblyVersion); + Information("AssemblyFileVersion -> {0}", assemblySemver); + Information("AssemblyInformationalVersion -> {0}", assemblySemver); }); Task("__UpdateDotNetStandardAssemblyVersionNumber") .Does(() => { - // NOTE: TEMPORARY fix only, while GitVersionTask does not support .Net Standard assemblies. See https://github.com/App-vNext/Polly/issues/176. - // This build Task can be removed when GitVersionTask supports .Net Standard assemblies. - var assemblySemVer = gitVersionOutput["AssemblySemVer"].ToString(); - Information("Updating NetStandard1.1 AssemblyVersion to {0}", assemblySemVer); - var replacedFiles = ReplaceRegexInFiles("./src/Polly.NetStandard11/Properties/AssemblyInfo.cs", "AssemblyVersion[(]\".*\"[)]", "AssemblyVersion(\"" + assemblySemVer +"\")"); - if (!replacedFiles.Any()) - { - Information("NetStandard1.1 AssemblyVersion could not be updated."); + Information("Updating Assembly Version Information"); + + var attributeToValueMap = new Dictionary() { + { "AssemblyVersion", assemblyVersion }, + { "AssemblyFileVersion", assemblySemver }, + { "AssemblyInformationalVersion", assemblySemver }, + }; + + var assemblyInfosToUpdate = GetFiles("./src/**/Properties/AssemblyInfo.cs") + .Select(f => f.FullPath) + .Where(f => !f.Contains("Specs")); + + foreach(var attributeMap in attributeToValueMap) { + var attribute = attributeMap.Key; + var value = attributeMap.Value; + + foreach(var assemblyInfo in assemblyInfosToUpdate) { + var replacedFiles = ReplaceRegexInFiles(assemblyInfo, attribute + "[(]\".*\"[)]", attribute + "(\"" + value +"\")"); + if (!replacedFiles.Any()) + { + throw new Exception($"{attribute} attribute could not be updated in {assemblyInfo}."); + } + } } + }); Task("__UpdateAppVeyorBuildNumber") .WithCriteria(() => AppVeyor.IsRunningOnAppVeyor) .Does(() => { - var fullSemVer = gitVersionOutput["FullSemVer"].ToString(); - AppVeyor.UpdateBuildVersion(fullSemVer); + AppVeyor.UpdateBuildVersion(appveyorBuildNumber); }); Task("__BuildSolutions") @@ -181,19 +210,12 @@ Task("__BuildSolutions") Task("__RunTests") .Does(() => { - XUnit2("./src/**/bin/" + configuration + "/**/*.Net4*.Specs.dll", new XUnit2Settings { - OutputDirectory = testResultsDir, - XmlReportV1 = true - }); -}); - -Task("__RunDotnetTests") - .Does(() => -{ - DotNetCoreTest("./src/Polly.NetStandard11.Specs/Polly.NetStandard11.Specs.csproj", new DotNetCoreTestSettings { - Configuration = configuration, - NoBuild = true - }); + foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")) { + DotNetCoreTest(specsProj.FullPath, new DotNetCoreTestSettings { + Configuration = configuration, + NoBuild = true + }); + } }); Task("__CopyOutputToNugetFolder") @@ -213,59 +235,6 @@ Task("__CopyOutputToNugetFolder") CopyFile(nuspecSrcFile, nuspecDestFile); }); -Task("__CopyNet40AsyncOutputToNugetFolder") - .Does(() => -{ - foreach(var project in net40AsyncProjectToNugetFolderMap.Keys) { - var sourceDir = srcDir + Directory(projectName + "." + project) + Directory("bin") + Directory(configuration); - - foreach(var targetFolder in net40AsyncProjectToNugetFolderMap[project]) { - var destDir = buildDir + Directory(net40AsyncProjectName) + Directory("lib"); - - Information("Copying {0} -> {1}.", sourceDir, destDir); - CopyDirectory(sourceDir, destDir); - } - } - - CopyFile(net40AsyncNuspecSrcFile, net40AsyncNuspecDestFile); -}); - -Task("__CreateNugetPackage") - .Does(() => -{ - var nugetVersion = gitVersionOutput["NuGetVersion"].ToString(); - var packageName = projectName; - - Information("Building {0}.{1}.nupkg", packageName, nugetVersion); - - var nuGetPackSettings = new NuGetPackSettings { - Id = packageName, - Title = packageName, - Version = nugetVersion, - OutputDirectory = nupkgDestDir - }; - - NuGetPack(nuspecDestFile, nuGetPackSettings); -}); - -Task("__CreateNet40AsyncNugetPackage") - .Does(() => -{ - var nugetVersion = gitVersionOutput["NuGetVersion"].ToString(); - var packageName = net40AsyncProjectName; - - Information("Building {0}.{1}.nupkg", packageName, nugetVersion); - - var nuGetPackSettings = new NuGetPackSettings { - Id = packageName, - Title = packageName, - Version = nugetVersion, - OutputDirectory = nupkgDestDir - }; - - NuGetPack(net40AsyncNuspecDestFile, nuGetPackSettings); -}); - Task("__StronglySignAssemblies") .Does(() => { @@ -285,8 +254,7 @@ Task("__StronglySignAssemblies") Task("__CreateSignedNugetPackage") .Does(() => { - var nugetVersion = gitVersionOutput["NuGetVersion"].ToString(); - var packageName = projectName + "-Signed"; + var packageName = projectName; Information("Building {0}.{1}.nupkg", packageName, nugetVersion); @@ -300,24 +268,6 @@ Task("__CreateSignedNugetPackage") NuGetPack(nuspecDestFile, nuGetPackSettings); }); -Task("__CreateSignedNet40AsyncNugetPackage") - .Does(() => -{ - var nugetVersion = gitVersionOutput["NuGetVersion"].ToString(); - var packageName = net40AsyncProjectName + "-Signed"; - - Information("Building {0}.{1}.nupkg", packageName, nugetVersion); - - var nuGetPackSettings = new NuGetPackSettings { - Id = packageName, - Title = packageName, - Version = nugetVersion, - OutputDirectory = nupkgDestDir - }; - - NuGetPack(net40AsyncNuspecDestFile, nuGetPackSettings); -}); - ////////////////////////////////////////////////////////////////////// // BUILD TASKS ////////////////////////////////////////////////////////////////////// @@ -330,14 +280,9 @@ Task("Build") .IsDependentOn("__UpdateAppVeyorBuildNumber") .IsDependentOn("__BuildSolutions") .IsDependentOn("__RunTests") - .IsDependentOn("__RunDotnetTests") .IsDependentOn("__CopyOutputToNugetFolder") - .IsDependentOn("__CopyNet40AsyncOutputToNugetFolder") - .IsDependentOn("__CreateNugetPackage") - .IsDependentOn("__CreateNet40AsyncNugetPackage") .IsDependentOn("__StronglySignAssemblies") - .IsDependentOn("__CreateSignedNugetPackage") - .IsDependentOn("__CreateSignedNet40AsyncNugetPackage"); + .IsDependentOn("__CreateSignedNugetPackage"); /////////////////////////////////////////////////////////////////////////////// // PRIMARY TARGETS diff --git a/src/Polly.Net40Async.Specs/Polly.Net40Async.Specs.csproj b/src/Polly.Net40Async.Specs/Polly.Net40Async.Specs.csproj deleted file mode 100644 index 626d048d8bd..00000000000 --- a/src/Polly.Net40Async.Specs/Polly.Net40Async.Specs.csproj +++ /dev/null @@ -1,47 +0,0 @@ - - - net45 - false - - - full - DEBUG;TRACE;NET45 - - - pdbonly - true - TRACE;RELEASE;NET45 - - - - - - - - - - - - - - - - - - - - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - \ No newline at end of file diff --git a/src/Polly.Net40Async.Specs/Properties/AssemblyInfo.cs b/src/Polly.Net40Async.Specs/Properties/AssemblyInfo.cs deleted file mode 100644 index d88b899ce3a..00000000000 --- a/src/Polly.Net40Async.Specs/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ -using System.Reflection; -using Xunit; - -[assembly: AssemblyTitle("Polly.Net40Async.Specs")] -[assembly: CollectionBehavior(DisableTestParallelization = false)] \ No newline at end of file diff --git a/src/Polly.Net40Async.Specs/readme.txt b/src/Polly.Net40Async.Specs/readme.txt deleted file mode 100644 index 7e84b253634..00000000000 --- a/src/Polly.Net40Async.Specs/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -This project exists to test Polly.Net40Async.csproj. - -Polly.Net40Async.Specs.csproj is compiled against .NET4.5, and has to be, to use XUnit version 2.0, on which we depend. This is however a valid way of xunit-testing a .NET40 assembly. See https://github.com/xunit/xunit/issues/241#issuecomment-67725679 diff --git a/src/Polly.Net40Async.nuspec b/src/Polly.Net40Async.nuspec deleted file mode 100644 index 80a48603dd5..00000000000 --- a/src/Polly.Net40Async.nuspec +++ /dev/null @@ -1,156 +0,0 @@ - - - - App vNext - Michael Wolfenden, App vNext - - Polly.Net40Async is a version of the Polly library for .NET 4.0 with async support via Microsoft.Bcl.Async. Polly allows developers to express resilience policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. - - en-US - https://raw.github.com/App-vNext/Polly/master/LICENSE.txt - https://raw.github.com/App-vNext/Polly/master/Polly.png - https://github.com/App-vNext/Polly - Exception Handling Resilience Transient Fault Policy Circuit Breaker CircuitBreaker Retry Wait Cache Cache-aside Bulkhead Fallback Timeout Throttle Parallelization - Copyright © 2018, App vNext - - v5.0 is a major release with significant new resilience policies: Timeout; Bulkhead Isolation; Fallback; Cache; and PolicyWrap. See release notes back to v5.0.0 for full details. - - 5.9.0 - --------------------- - - Allow Timeout.InfiniteTimeSpan (no timeout) for TimeoutPolicy. - - Add .AsPolicy<TResult> and .AsAsyncPolicy<TResult> methods for converting non-generic policies to generic policies. - - Per Semver, indicates deprecation of overloads and properties intended to be removed or renamed in Polly v6. - - 5.8.0 - --------------------- - - Add a new onBreak overload that provides the prior state on a transition to an open state - - Bug fix: RelativeTtl in CachePolicy now always returns a ttl relative to time item is cached - - 5.7.0 - --------------------- - - Minor cache fixes - - Add ability to calculate cache Ttl based on item to cache - - Allow user-created custom policies - - 5.6.1 - --------------------- - - Extend PolicyWrap syntax with interfaces - - 5.6.0 - --------------------- - - Add ability to handle inner exceptions natively: .HandleInner<TEx>() - - Allow WaitAndRetry policies to calculate wait based on the handled fault - - Add the ability to access the policies within an IPolicyWrap - - Allow PolicyWrap to take interfaces as parameters - - Bug fix: set context keys for generic execute method with PolicyWrap - - Bug fix: generic TResult method with non-generic fallback policy - - Performance improvements - - 5.5.0 - --------------------- - - Bug fix: non-generic CachePolicy with PolicyWrap - - Add Cache interfaces - - 5.4.0 - --------------------- - - Add CachePolicy: cache-aside pattern, with interfaces for pluggable cache providers and serializers. - - Bug fix: Sync TimeoutPolicy in pessimistic mode no longer interposes AggregateException. - - Provide public factory methods for PolicyResult, to support testing. - - Fallback delegates can now take handled fault as input parameter. - - 5.3.1 - --------------------- - - Make ISyncPolicy<TResult> public - - (Upgrade solution to msbuild15) - - 5.3.0 - --------------------- - - Fix ExecuteAndCapture() usage with PolicyWrap - - Allow Fallback delegates to take execution Context - - Provide IReadOnlyPolicyRegistry interface - - 5.2.0 - --------------------- - - Add PolicyRegistry for storing and retrieving policies. - - Add interfaces by policy type and execution type. - - Change .NetStandard minimum support to NetStandard1.1. - - 5.1.0 - --------------------- - - Allow different parts of a policy execution to exchange data via a mutable Context travelling with each execution. - - 5.0.6 - --------------------- - - (.NETStandard1.0 changes only.) - - 5.0.5 - --------------------- - - Bug fix: Prevent request stampede during half-open state of CircuitBreaker and AdvancedCircuitBreaker. Enforce only one new trial call per break duration, during half-open state. - - Bug fix: Prevent duplicate raising of the onBreak delegate, if executions started when a circuit was closed, return faults when a circuit has already opened. - - Optimisation: Optimise hotpaths for Circuit-Breaker, Retry and Fallback policies. - - Add NoOpPolicy: NoOpPolicy executes delegates without intervention; for eg stubbing out Polly in unit testing. - - 5.0.4 pre - --------------------- - - Fix Microsoft.Bcl and Nito.AsyncEx dependencies for Polly.Net40Async. - - 5.0.3 RTM - --------------------- - - Refine implementation of cancellable synchronous WaitAndRetry - - Minor breaking change: Where a user delegate does not observe cancellation, Polly will now honour the delegate's outcome rather than throw for the unobserved cancellation (issue 188). - - 5.0.2 alpha - --------------------- - - Add full specs support for .NET40. - - Fix issue 179: Make Net4.0 async implementation for Bulkhead truly async. - - 5.0.1 alpha - --------------------- - - (Add a .NETStandard1.0 target.) - - 5.0.0 alpha - --------------------- - A major release, adding significant new resilience policies: - - Timeout policy: allows timing out any execution - - Bulkhead isolation policy: limits the resources consumable by governed actions, such that a faulting channel cannot cause cascading failures. - - Fallback policy: provides for a fallback execution or value, in case of overall failure - - PolicyWrap: allows flexibly combining Policy instances of any type, to form an overall resilience strategy. - - Other changes include: - - Add PolicyKeys and context to all policy executions, for logging and to support later introduction of policy events and metrics. - - Add CancellationToken support to synchronous executions. - - Add some missing ExecuteAndCapture/Async overloads. - - Remove invalid ExecuteAsync overloads taking (but not making use of) a CancellationToken - - Provide .NET4.0 support uniquely through Polly.NET40Async package - - Retire ContextualPolicy (not part of documented API; support now in Policy base class) - - Discontinue .NET3.5 support - - 4.3.0 - --------------------- - - Added ability for policies to handle return results. Optimised circuit-breaker hot path. Fixed circuit-breaker threshold bug. - - 4.2.4 - --------------------- - - Added overloads to WaitAndRetry and WaitAndRetryAsync methods that accept an onRetry delegate which includes the attempt count. - - 4.2.3 - --------------------- - - Cleaned up new Polly.Net40Async NuGet package, removing Polly.dll and unused framework folders. - - 4.2.2 - --------------------- - - Add new Polly.Net40Async project supporting async for .NET40 via Microsoft.Bcl.Async. This is available as separate Nuget packages Polly.Net40Async and Polly.Net40Async-signed. - - - - - - - - - - - - - - diff --git a/src/Polly.Net40Async/Properties/AssemblyInfo.cs b/src/Polly.Net40Async/Properties/AssemblyInfo.cs deleted file mode 100644 index 99a05892795..00000000000 --- a/src/Polly.Net40Async/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("Polly")] -[assembly: CLSCompliant(false)] // Because Nito.AsycEx, on which Polly.Net40Async depends, is not CLSCompliant. - -[assembly: InternalsVisibleTo("Polly.Net40Async.Specs")] \ No newline at end of file diff --git a/src/Polly.Net40Async/app.config b/src/Polly.Net40Async/app.config deleted file mode 100644 index e03ea0a5f08..00000000000 --- a/src/Polly.Net40Async/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Polly.Net45.Specs/Polly.Net45.Specs.csproj b/src/Polly.Net45.Specs/Polly.Net45.Specs.csproj deleted file mode 100644 index 52745ff6960..00000000000 --- a/src/Polly.Net45.Specs/Polly.Net45.Specs.csproj +++ /dev/null @@ -1,44 +0,0 @@ - - - false - net45 - Library - - - full - TRACE;DEBUG;NET45 - - - pdbonly - true - TRACE;RELEASE;NET45 - - - - - - - - - - - - - - - - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - \ No newline at end of file diff --git a/src/Polly.Net45.Specs/Properties/AssemblyInfo.cs b/src/Polly.Net45.Specs/Properties/AssemblyInfo.cs deleted file mode 100644 index c35c2d67142..00000000000 --- a/src/Polly.Net45.Specs/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ -using System.Reflection; -using Xunit; - -[assembly: AssemblyTitle("Polly.Net45.Specs")] -[assembly: CollectionBehavior(DisableTestParallelization = false)] \ No newline at end of file diff --git a/src/Polly.Net45/Polly.Net45.csproj b/src/Polly.Net45/Polly.Net45.csproj deleted file mode 100644 index f09c8a0b4a8..00000000000 --- a/src/Polly.Net45/Polly.Net45.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - Polly - - false - true - Polly - false - net45 - true - - - full - TRACE;DEBUG;NET45 - - - pdbonly - TRACE;RELEASE;NET45 - - - - Properties\GlobalAssemblyInfo.cs - - - - - - \ No newline at end of file diff --git a/src/Polly.Net45/Properties/AssemblyInfo.cs b/src/Polly.Net45/Properties/AssemblyInfo.cs deleted file mode 100644 index a0b91bffb23..00000000000 --- a/src/Polly.Net45/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("Polly")] -[assembly: CLSCompliant(true)] - -[assembly: InternalsVisibleTo("Polly.Net45.Specs")] \ No newline at end of file diff --git a/src/Polly.NetStandard11/Properties/AssemblyInfo.cs b/src/Polly.NetStandard11/Properties/AssemblyInfo.cs index 3b88cf4bf5f..8bea54c3b51 100644 --- a/src/Polly.NetStandard11/Properties/AssemblyInfo.cs +++ b/src/Polly.NetStandard11/Properties/AssemblyInfo.cs @@ -3,7 +3,9 @@ using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Polly")] -[assembly: AssemblyVersion("5.9.0.0")] +[assembly: AssemblyInformationalVersion("6.0.1.0")] +[assembly: AssemblyFileVersion("6.0.1.0")] +[assembly: AssemblyVersion("6.0.0.0")] [assembly: CLSCompliant(true)] [assembly: InternalsVisibleTo("Polly.NetStandard11.Specs")] \ No newline at end of file diff --git a/src/Polly.NetStandard20.Specs/Polly.NetStandard20.Specs.csproj b/src/Polly.NetStandard20.Specs/Polly.NetStandard20.Specs.csproj new file mode 100644 index 00000000000..6a73e8a2a92 --- /dev/null +++ b/src/Polly.NetStandard20.Specs/Polly.NetStandard20.Specs.csproj @@ -0,0 +1,32 @@ + + + false + Library + netcoreapp2.0 + library + + + full + TRACE;DEBUG;NETCOREAPP2_0 + + + pdbonly + true + TRACE;RELEASE;NETCOREAPP2_0 + + + + + + + + + + Properties\GlobalAssemblyInfo.cs + + + + + + + diff --git a/src/Polly.NetStandard20.Specs/Properties/AssemblyInfo.cs b/src/Polly.NetStandard20.Specs/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..e76dbc82f26 --- /dev/null +++ b/src/Polly.NetStandard20.Specs/Properties/AssemblyInfo.cs @@ -0,0 +1 @@ +[assembly: Xunit.CollectionBehavior(DisableTestParallelization = false)] \ No newline at end of file diff --git a/src/Polly.Net40Async/Polly.Net40Async.csproj b/src/Polly.NetStandard20/Polly.NetStandard20.csproj similarity index 52% rename from src/Polly.Net40Async/Polly.Net40Async.csproj rename to src/Polly.NetStandard20/Polly.NetStandard20.csproj index 42ca565a8c5..11f9a3042e6 100644 --- a/src/Polly.Net40Async/Polly.Net40Async.csproj +++ b/src/Polly.NetStandard20/Polly.NetStandard20.csproj @@ -1,30 +1,25 @@ - + - Polly - net40 + netstandard2.0 + Polly + en-US false true - true - true + Polly full - TRACE;DEBUG;NET40 + TRACE;DEBUG;PORTABLE;NETSTANDARD;NETSTANDARD2_0 pdbonly true - TRACE;RELEASE;NET40 + TRACE;PORTABLE;RELEASE;NETSTANDARD;NETSTANDARD2_0 - - - - - - - - + + False + diff --git a/src/Polly.NetStandard20/Properties/AssemblyInfo.cs b/src/Polly.NetStandard20/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..7d9cb58df33 --- /dev/null +++ b/src/Polly.NetStandard20/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Polly")] +[assembly: AssemblyInformationalVersion("6.0.1.0")] +[assembly: AssemblyFileVersion("6.0.1.0")] +[assembly: AssemblyVersion("6.0.0.0")] +[assembly: CLSCompliant(true)] + +[assembly: InternalsVisibleTo("Polly.NetStandard20.Specs")] \ No newline at end of file diff --git a/src/Polly.Shared/Context.cs b/src/Polly.Shared/Context.cs index c114340f2e7..03393914453 100644 --- a/src/Polly.Shared/Context.cs +++ b/src/Polly.Shared/Context.cs @@ -39,13 +39,6 @@ public Context() /// public String PolicyKey { get; internal set; } - /// - /// A key unique to the call site of the current execution. - /// The value is set by using the constructor taking an operationKey parameter. - /// - [Obsolete("This property is being renamed OperationKey, from Polly v6.")] - public String ExecutionKey => OperationKey; - /// /// A key unique to the call site of the current execution. /// instances are commonly reused across multiple call sites. Set an OperationKey so that logging and metrics can distinguish usages of policy instances at different call sites. @@ -53,13 +46,6 @@ public Context() /// public String OperationKey { get; } - /// - /// A Guid guaranteed to be unique to each execution. - /// Acts as a correlation id so that events specific to a single execution can be identified in logging and telemetry. - /// - [Obsolete("This property is being renamed CorrelationId, from Polly v6.")] - public Guid ExecutionGuid => CorrelationId; - /// /// A Guid guaranteed to be unique to each execution. /// Acts as a correlation id so that events specific to a single execution can be identified in logging and telemetry. diff --git a/src/Polly.Shared/Fallback/FallbackSyntax.cs b/src/Polly.Shared/Fallback/FallbackSyntax.cs index 82943dbee91..9e15f3ea905 100644 --- a/src/Polly.Shared/Fallback/FallbackSyntax.cs +++ b/src/Polly.Shared/Fallback/FallbackSyntax.cs @@ -75,24 +75,6 @@ public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action fallbackAction(ct), (exception, ctx) => onFallback(exception)); } - /// - /// Builds a which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls with details of the handled exception and the execution context; then calls . - /// - /// The policy builder. - /// The fallback action. - /// The action to call before invoking the fallback delegate. - /// fallbackAction - /// onFallback - /// The policy instance. - [Obsolete("This overload is deprecated and will be removed in a future release. Prefer the overload in which both fallbackAction and onFallback take a Context input parameter.")] - public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action fallbackAction, Action onFallback) - { - if (fallbackAction == null) throw new ArgumentNullException(nameof(fallbackAction)); - if (onFallback == null) throw new ArgumentNullException(nameof(onFallback)); - - return policyBuilder.Fallback((outcome, ctx, ct) => fallbackAction(), onFallback); - } - /// /// Builds a which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls with details of the handled exception and the execution context; then calls . /// @@ -109,25 +91,7 @@ public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action fallbackAction(ctx), onFallback); } - - /// - /// Builds a which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls with details of the handled exception and the execution context; then calls . - /// - /// The policy builder. - /// The fallback action. - /// The action to call before invoking the fallback delegate. - /// fallbackAction - /// onFallback - /// The policy instance. - [Obsolete("This overload is deprecated and will be removed in a future release. Prefer the overload in which both fallbackAction and onFallback take a Context input parameter.")] - public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Action fallbackAction, Action onFallback) - { - if (fallbackAction == null) throw new ArgumentNullException(nameof(fallbackAction)); - if (onFallback == null) throw new ArgumentNullException(nameof(onFallback)); - - return policyBuilder.Fallback((outcome, ctx, ct) => fallbackAction(ct), onFallback); - } - + /// /// Builds a which provides a fallback action if the main execution fails. Executes the main delegate, but if this throws a handled exception, first calls with details of the handled exception and the execution context; then calls . /// @@ -283,24 +247,6 @@ public static FallbackPolicy Fallback(this PolicyBuilder fallbackValue, onFallback); } - /// - /// Builds a which provides a fallback value if the main execution fails. Executes the main delegate, but if this throws a handled exception or raises a handled result, first calls with details of the handled exception or result and the execution context; then calls and returns its result. - /// - /// The policy builder. - /// The fallback action. - /// The action to call before invoking the fallback delegate. - /// fallbackAction - /// onFallback - /// The policy instance. - [Obsolete("This overload is deprecated and will be removed in a future release. Prefer the overload in which both fallbackAction and onFallback take a Context input parameter.")] - public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Func fallbackAction, Action, Context> onFallback) - { - if (fallbackAction == null) throw new ArgumentNullException(nameof(fallbackAction)); - if (onFallback == null) throw new ArgumentNullException(nameof(onFallback)); - - return policyBuilder.Fallback((outcome, ctx, ct) => fallbackAction(), onFallback); - } - /// /// Builds a which provides a fallback value if the main execution fails. Executes the main delegate, but if this throws a handled exception or raises a handled result, first calls with details of the handled exception or result and the execution context; then calls and returns its result. /// @@ -318,24 +264,6 @@ public static FallbackPolicy Fallback(this PolicyBuilder fallbackAction(ctx), onFallback); } - /// - /// Builds a which provides a fallback value if the main execution fails. Executes the main delegate, but if this throws a handled exception or raises a handled result, first calls with details of the handled exception or result and the execution context; then calls and returns its result. - /// - /// The policy builder. - /// The fallback action. - /// The action to call before invoking the fallback delegate. - /// fallbackAction - /// onFallback - /// The policy instance. - [Obsolete("This overload is deprecated and will be removed in a future release. Prefer the overload in which both fallbackAction and onFallback take a Context input parameter.")] - public static FallbackPolicy Fallback(this PolicyBuilder policyBuilder, Func fallbackAction, Action, Context> onFallback) - { - if (fallbackAction == null) throw new ArgumentNullException(nameof(fallbackAction)); - if (onFallback == null) throw new ArgumentNullException(nameof(onFallback)); - - return policyBuilder.Fallback((outcome, ctx, ct) => fallbackAction(ct), onFallback); - } - /// /// Builds a which provides a fallback value if the main execution fails. Executes the main delegate, but if this throws a handled exception or raises a handled result, first calls with details of the handled exception or result and the execution context; then calls and returns its result. /// diff --git a/src/Polly.Shared/Fallback/FallbackSyntaxAsync.cs b/src/Polly.Shared/Fallback/FallbackSyntaxAsync.cs index 1de7ee06f03..9663fd59bec 100644 --- a/src/Polly.Shared/Fallback/FallbackSyntaxAsync.cs +++ b/src/Polly.Shared/Fallback/FallbackSyntaxAsync.cs @@ -48,25 +48,7 @@ public static FallbackPolicy FallbackAsync(this PolicyBuilder policyBuilder, Fun (outcome, context) => onFallbackAsync(outcome) ); } - - /// - /// Builds a which provides a fallback action if the main execution fails. Executes the main delegate asynchronously, but if this throws a handled exception, first asynchronously calls with details of the handled exception and execution context; then asynchronously calls . - /// - /// The policy builder. - /// The fallback delegate. - /// The action to call asynchronously before invoking the fallback delegate. - /// fallbackAction - /// onFallbackAsync - /// The policy instance. - [Obsolete("This overload is deprecated and will be removed in a future release. Prefer the overload in which both fallbackAction and onFallbackAsync take a Context input parameter.")] - public static FallbackPolicy FallbackAsync(this PolicyBuilder policyBuilder, Func fallbackAction, Func onFallbackAsync) - { - if (fallbackAction == null) throw new ArgumentNullException(nameof(fallbackAction)); - if (onFallbackAsync == null) throw new ArgumentNullException(nameof(onFallbackAsync)); - - return policyBuilder.FallbackAsync((outcome, ctx, ct) => fallbackAction(ct), onFallbackAsync); - } - + /// /// Builds a which provides a fallback action if the main execution fails. Executes the main delegate asynchronously, but if this throws a handled exception, first asynchronously calls with details of the handled exception and execution context; then asynchronously calls . /// @@ -205,25 +187,7 @@ public static FallbackPolicy FallbackAsync(this PolicyBuilder< onFallbackAsync ); } - - /// - /// Builds a which provides a fallback value if the main execution fails. Executes the main delegate asynchronously, but if this throws a handled exception or raises a handled result, first asynchronously calls with details of the handled exception or result and the execution context; then asynchronously calls and returns its result. - /// - /// The policy builder. - /// The fallback delegate. - /// The action to call asynchronously before invoking the fallback delegate. - /// fallbackAction - /// onFallbackAsync - /// The policy instance. - [Obsolete("This overload is deprecated and will be removed in a future release. Prefer the overload in which both fallbackAction and onFallbackAsync take a Context input parameter.")] - public static FallbackPolicy FallbackAsync(this PolicyBuilder policyBuilder, Func> fallbackAction, Func, Context, Task> onFallbackAsync) - { - if (fallbackAction == null) throw new ArgumentNullException(nameof(fallbackAction)); - if (onFallbackAsync == null) throw new ArgumentNullException(nameof(onFallbackAsync)); - - return policyBuilder.FallbackAsync((outcome, ctx, ct) => fallbackAction(ct), onFallbackAsync); - } - + /// /// Builds a which provides a fallback value if the main execution fails. Executes the main delegate asynchronously, but if this throws a handled exception or raises a handled result, first asynchronously calls with details of the handled exception or result and the execution context; then asynchronously calls and returns its result. /// diff --git a/src/Polly.Shared/Policy.Async.ExecuteOverloads.cs b/src/Polly.Shared/Policy.Async.ExecuteOverloads.cs index 66c73e1f17b..32f04cdd891 100644 --- a/src/Polly.Shared/Policy.Async.ExecuteOverloads.cs +++ b/src/Polly.Shared/Policy.Async.ExecuteOverloads.cs @@ -21,30 +21,6 @@ public Task ExecuteAsync(Func action) return ExecuteAsync((ctx, ct) => action(), new Context(), DefaultCancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, IDictionary contextData) - { - return ExecuteAsync((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, Context context) - { - return ExecuteAsync((ctx, ct) => action(), context, DefaultCancellationToken, DefaultContinueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy. /// @@ -67,70 +43,6 @@ public Task ExecuteAsync(Func action, Context context) return ExecuteAsync((ctx, ct) => action(ctx), context, DefaultCancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Whether to continue on a captured synchronization context. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(), new Context(), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, Context context, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(), context, DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ctx), new Context(contextData), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, Context context, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ctx), context, DefaultCancellationToken, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy. /// @@ -142,32 +54,6 @@ public Task ExecuteAsync(Func action, CancellationToken return ExecuteAsync((ctx, ct) => action(ct), new Context(), cancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, IDictionary contextData, CancellationToken cancellationToken) - { - return ExecuteAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, Context context, CancellationToken cancellationToken) - { - return ExecuteAsync((ctx, ct) => action(ct), context, cancellationToken, DefaultContinueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy. /// @@ -204,37 +90,7 @@ public Task ExecuteAsync(Func action, CancellationToken { return ExecuteAsync((ctx, ct) => action(ct), new Context(), cancellationToken, continueOnCapturedContext); } - - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// Whether to continue on a captured synchronization context. - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, IDictionary contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// Please use asynchronous-defined policies when calling asynchronous ExecuteAsync (and similar) methods. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ct), context, cancellationToken, continueOnCapturedContext); - } - + /// /// Executes the specified asynchronous action within the policy. /// @@ -280,33 +136,6 @@ public Task ExecuteAsync(Func> action) return ExecuteAsync((ctx, ct) => action(), new Context(), DefaultCancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData) - { - return ExecuteAsync((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context) - { - return ExecuteAsync((ctx, ct) => action(), context, DefaultCancellationToken, DefaultContinueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -332,78 +161,6 @@ public Task ExecuteAsync(Func> action, return ExecuteAsync((ctx, ct) => action(ctx), context, DefaultCancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(), new Context(), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(), context, DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ctx), new Context(contextData), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ctx), context, DefaultCancellationToken, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -417,35 +174,6 @@ public Task ExecuteAsync(Func return ExecuteAsync((ctx, ct) => action(ct), new Context(), cancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData, CancellationToken cancellationToken) - { - return ExecuteAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy is in use, also cancels any further retries. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context, CancellationToken cancellationToken) - { - return ExecuteAsync((ctx, ct) => action(ct), context, cancellationToken, DefaultContinueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -488,39 +216,6 @@ public Task ExecuteAsync(Func return ExecuteAsync((ctx, ct) => action(ct), new Context(), cancellationToken, continueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// A cancellation token which can be used to cancel the action. When a retry policy is in use, also cancels any further retries. - /// The value returned by the action - /// Please use asynchronous-defined policies when calling asynchronous ExecuteAsync (and similar) methods. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ct), context, cancellationToken, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -571,34 +266,7 @@ public Task ExecuteAndCaptureAsync(Func action) { return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(), DefaultCancellationToken, DefaultContinueOnCapturedContext); } - - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, IDictionary contextData) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, Context context) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), context, DefaultCancellationToken, DefaultContinueOnCapturedContext); - } - + /// /// Executes the specified asynchronous action within the policy and returns the captured result. /// @@ -624,77 +292,6 @@ public Task ExecuteAndCaptureAsync(Func action, Con return ExecuteAndCaptureAsync((ctx, ct) => action(ctx), context, DefaultCancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Whether to continue on a captured synchronization context. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, Context context, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), context, DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ctx), new Context(contextData), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, Context context, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ctx), context, DefaultCancellationToken, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the captured result. /// @@ -706,34 +303,6 @@ public Task ExecuteAndCaptureAsync(Func a return ExecuteAndCaptureAsync((ctx, ct) => action(ct), new Context(), cancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, IDictionary contextData, CancellationToken cancellationToken) - { - return ExecuteAndCaptureAsync(action, new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, Context context, CancellationToken cancellationToken) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), context, cancellationToken, DefaultContinueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the captured result. /// @@ -772,38 +341,7 @@ public Task ExecuteAndCaptureAsync(Func a { return ExecuteAndCaptureAsync((ctx, ct) => action(ct), new Context(), cancellationToken, continueOnCapturedContext); } - - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// Whether to continue on a captured synchronization context. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, IDictionary contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// Please use asynchronous-defined policies when calling asynchronous ExecuteAsync (and similar) methods. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAndCaptureAsync(Func action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), context, cancellationToken, continueOnCapturedContext); - } - + /// /// Executes the specified asynchronous action within the policy and returns the captured result. /// @@ -860,36 +398,6 @@ public Task> ExecuteAndCaptureAsync(Func action(), new Context(), DefaultCancellationToken, DefaultContinueOnCapturedContext); } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), context, DefaultCancellationToken, DefaultContinueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -917,82 +425,6 @@ public Task> ExecuteAndCaptureAsync(Func action(ctx), context, DefaultCancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Whether to continue on a captured synchronization context. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), context, DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ctx), new Context(contextData), DefaultCancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ctx), context, DefaultCancellationToken, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -1005,38 +437,7 @@ public Task> ExecuteAndCaptureAsync(Func action(ct), new Context(), cancellationToken, DefaultContinueOnCapturedContext); } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData, CancellationToken cancellationToken) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context, CancellationToken cancellationToken) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), context, cancellationToken, DefaultContinueOnCapturedContext); - } - + /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -1081,40 +482,6 @@ public Task> ExecuteAndCaptureAsync(Func action(ct), new Context(), cancellationToken, continueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// The captured result - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// Whether to continue on a captured synchronization context. - /// The captured result - /// Please use asynchronous-defined policies when calling asynchronous ExecuteAsync (and similar) methods. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), context, cancellationToken, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// diff --git a/src/Polly.Shared/Policy.Async.TResult.ExecuteOverloads.cs b/src/Polly.Shared/Policy.Async.TResult.ExecuteOverloads.cs index 9aa8aeed427..3b50b32be34 100644 --- a/src/Polly.Shared/Policy.Async.TResult.ExecuteOverloads.cs +++ b/src/Polly.Shared/Policy.Async.TResult.ExecuteOverloads.cs @@ -23,46 +23,7 @@ public Task ExecuteAsync(Func> action) { return ExecuteAsync((ctx, ct) => action(), new Context(), CancellationToken.None, DefaultContinueOnCapturedContext); } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(), new Context(), CancellationToken.None, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData) - { - return ExecuteAsync((ctx, ct) => action(), new Context(contextData), CancellationToken.None, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context) - { - return ExecuteAsync((ctx, ct) => action(), context, CancellationToken.None, DefaultContinueOnCapturedContext); - } - + /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -87,62 +48,6 @@ public Task ExecuteAsync(Func> action, Context c return ExecuteAsync((ctx, ct) => action(ctx), context, CancellationToken.None, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(), new Context(contextData), CancellationToken.None, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(), context, CancellationToken.None, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ctx), new Context(contextData), CancellationToken.None, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ctx), context, CancellationToken.None, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -169,34 +74,6 @@ public Task ExecuteAsync(Func> action, return ExecuteAsync((ctx, ct) => action(ct), new Context(), cancellationToken, continueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData, CancellationToken cancellationToken) - { - return ExecuteAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy is in use, also cancels any further retries. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context, CancellationToken cancellationToken) - { - return ExecuteAsync((ctx, ct) => action(ct), context, cancellationToken, DefaultContinueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -223,38 +100,6 @@ public Task ExecuteAsync(Func return ExecuteAsync(action, context, cancellationToken, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// Whether to continue on a captured synchronization context. - /// The value returned by the action - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, IDictionary contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// A cancellation token which can be used to cancel the action. When a retry policy is in use, also cancels any further retries. - /// The value returned by the action - /// Please use asynchronous-defined policies when calling asynchronous ExecuteAsync (and similar) methods. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task ExecuteAsync(Func> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAsync((ctx, ct) => action(ct), context, cancellationToken, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -302,46 +147,7 @@ public Task> ExecuteAndCaptureAsync(Func> ac { return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(), CancellationToken.None, DefaultContinueOnCapturedContext); } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Whether to continue on a captured synchronization context. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(), CancellationToken.None, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// contextData - /// The captured result - [DebuggerStepThrough] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(contextData), CancellationToken.None, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), context, CancellationToken.None, DefaultContinueOnCapturedContext); - } - + /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -367,66 +173,6 @@ public Task> ExecuteAndCaptureAsync(Func action(ctx), context, CancellationToken.None, DefaultContinueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), new Context(contextData), CancellationToken.None, continueOnCapturedContext); - } - - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(), context, CancellationToken.None, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ctx), new Context(contextData), CancellationToken.None, continueOnCapturedContext); - } - - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ctx), context, CancellationToken.None, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -453,35 +199,6 @@ public Task> ExecuteAndCaptureAsync(Func action(ct), new Context(), cancellationToken, continueOnCapturedContext); } - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData, CancellationToken cancellationToken) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context, CancellationToken cancellationToken) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), context, cancellationToken, DefaultContinueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// @@ -509,38 +226,6 @@ public Task> ExecuteAndCaptureAsync(Func - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// The captured result - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, IDictionary contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), new Context(contextData), cancellationToken, continueOnCapturedContext); - } - - /// - /// Executes the specified asynchronous action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// Whether to continue on a captured synchronization context. - /// A cancellation token which can be used to cancel the action. When a retry policy in use, also cancels any further retries. - /// The captured result - /// Please use asynchronous-defined policies when calling asynchronous ExecuteAsync (and similar) methods. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public Task> ExecuteAndCaptureAsync(Func> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext) - { - return ExecuteAndCaptureAsync((ctx, ct) => action(ct), context, cancellationToken, continueOnCapturedContext); - } - /// /// Executes the specified asynchronous action within the policy and returns the result. /// diff --git a/src/Polly.Shared/Policy.ExecuteOverloads.cs b/src/Polly.Shared/Policy.ExecuteOverloads.cs index 47a7b524a28..b3422564ce5 100644 --- a/src/Polly.Shared/Policy.ExecuteOverloads.cs +++ b/src/Polly.Shared/Policy.ExecuteOverloads.cs @@ -20,30 +20,6 @@ public void Execute(Action action) Execute((ctx, ct) => action(), new Context(), DefaultCancellationToken); } - /// - /// Executes the specified action within the policy. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public void Execute(Action action, IDictionary contextData) - { - Execute((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken); - } - - /// - /// Executes the specified action within the policy. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public void Execute(Action action, Context context) - { - Execute((ctx, ct) => action(), context, DefaultCancellationToken); - } - /// /// Executes the specified action within the policy. /// @@ -77,33 +53,6 @@ public void Execute(Action action, CancellationToken cancella Execute((ctx, ct) => action(ct), new Context(), cancellationToken); } - /// - /// Executes the specified action within the policy. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// The cancellation token. - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public void Execute(Action action, IDictionary contextData, CancellationToken cancellationToken) - { - Execute((ctx, ct) => action(ct), new Context(contextData), cancellationToken); - } - - /// - /// Executes the specified action within the policy. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The cancellation token. - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public void Execute(Action action, Context context, CancellationToken cancellationToken) - { - Execute((ctx, ct) => action(ct), context, cancellationToken); - } - /// /// Executes the specified action within the policy. /// @@ -147,42 +96,6 @@ public TResult Execute(Func action) return Execute((ctx, ct) => action(), new Context(), DefaultCancellationToken); } - /// - /// Executes the specified action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// contextData - /// - /// The value returned by the action - /// - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public TResult Execute(Func action, IDictionary contextData) - { - return Execute((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken); - } - - /// - /// Executes the specified action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// contextData - /// - /// The value returned by the action - /// - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public TResult Execute(Func action, Context context) - { - return Execute((ctx, ct) => action(), context, DefaultCancellationToken); - } - /// /// Executes the specified action within the policy and returns the result. /// @@ -230,37 +143,6 @@ public TResult Execute(Func action, Cancell return Execute((ctx, ct) => action(ct), new Context(), cancellationToken); } - /// - /// Executes the specified action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// The cancellation token. - /// The value returned by the action - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public TResult Execute(Func action, IDictionary contextData, CancellationToken cancellationToken) - { - return Execute((ctx, ct) => action(ct), new Context(contextData), cancellationToken); - } - - /// - /// Executes the specified action within the policy and returns the result. - /// - /// The type of the result. - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The cancellation token. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public TResult Execute(Func action, Context context, CancellationToken cancellationToken) - { - return Execute((ctx, ct) => action(ct), context, cancellationToken); - } - /// /// Executes the specified action within the policy and returns the result. /// @@ -311,33 +193,6 @@ public PolicyResult ExecuteAndCapture(Action action) return ExecuteAndCapture((ctx, ct) => action(), new Context(), DefaultCancellationToken); } - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Action action, IDictionary contextData) - { - return ExecuteAndCapture((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken); - } - - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Action action, Context context) - { - return ExecuteAndCapture((ctx, ct) => action(), context, DefaultCancellationToken); - } - /// /// Executes the specified action within the policy and returns the captured result. /// @@ -375,35 +230,6 @@ public PolicyResult ExecuteAndCapture(Action action, Cancella return ExecuteAndCapture((ctx, ct) => action(ct), new Context(), cancellationToken); } - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// The cancellation token. - /// The captured result - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Action action, IDictionary contextData, CancellationToken cancellationToken) - { - return ExecuteAndCapture((ctx, ct) => action(ct), new Context(contextData), cancellationToken); - } - - /// - /// Executes the specified action within the policy and returns the captured result - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The cancellation token. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Action action, Context context, CancellationToken cancellationToken) - { - return ExecuteAndCapture((ctx, ct) => action(ct), context, cancellationToken); - } - /// /// Executes the specified action within the policy and returns the captured result. /// @@ -456,35 +282,6 @@ public PolicyResult ExecuteAndCapture(Func action) return ExecuteAndCapture((ctx, ct) => action(), new Context(), DefaultCancellationToken); } - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Func action, IDictionary contextData) - { - return ExecuteAndCapture((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken); - } - - - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Func action, Context context) - { - return ExecuteAndCapture((ctx, ct) => action(), context, DefaultCancellationToken); - } - /// /// Executes the specified action within the policy and returns the captured result. /// @@ -524,37 +321,6 @@ public PolicyResult ExecuteAndCapture(Func action(ct), new Context(), cancellationToken); } - - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The type of the result. - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// The cancellation token. - /// The captured result - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Func action, IDictionary contextData, CancellationToken cancellationToken) - { - return ExecuteAndCapture((ctx, ct) => action(ct), new Context(contextData), cancellationToken); - } - - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The cancellation token. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Func action, Context context, CancellationToken cancellationToken) - { - return ExecuteAndCapture((ctx, ct) => action(ct), context, cancellationToken); - } - /// /// Executes the specified action within the policy and returns the captured result. /// diff --git a/src/Polly.Shared/Policy.TResult.ExecuteOverloads.cs b/src/Polly.Shared/Policy.TResult.ExecuteOverloads.cs index ae1d8600bfd..b97541907a9 100644 --- a/src/Polly.Shared/Policy.TResult.ExecuteOverloads.cs +++ b/src/Polly.Shared/Policy.TResult.ExecuteOverloads.cs @@ -23,40 +23,6 @@ public TResult Execute(Func action) return Execute((ctx, ct) => action(), new Context(), DefaultCancellationToken); } - /// - /// Executes the specified action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// contextData - /// - /// The value returned by the action - /// - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public TResult Execute(Func action, IDictionary contextData) - { - return Execute((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken); - } - - /// - /// Executes the specified action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// context - /// - /// The value returned by the action - /// - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public TResult Execute(Func action, Context context) - { - return Execute((ctx, ct) => action(), context, DefaultCancellationToken); - } - /// /// Executes the specified action within the policy and returns the result. /// @@ -100,36 +66,7 @@ public TResult Execute(Func action, CancellationToke { return Execute((ctx, ct) => action(ct), new Context(), cancellationToken); } - - /// - /// Executes the specified action within the policy and returns the result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// The cancellation token. - /// The value returned by the action - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public TResult Execute(Func action, IDictionary contextData, CancellationToken cancellationToken) - { - return Execute((ctx, ct) => action(ct), new Context(contextData), cancellationToken); - } - - /// - /// Executes the specified action within the policy and returns the result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The cancellation token. - /// The value returned by the action - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public TResult Execute(Func action, Context context, CancellationToken cancellationToken) - { - return Execute((ctx, ct) => action(ct), context, cancellationToken); - } - + /// /// Executes the specified action within the policy and returns the result. /// @@ -175,34 +112,6 @@ public PolicyResult ExecuteAndCapture(Func action) return ExecuteAndCapture((ctx, ct) => action(), new Context(), DefaultCancellationToken); } - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Func action, IDictionary contextData) - { - return ExecuteAndCapture((ctx, ct) => action(), new Context(contextData), DefaultCancellationToken); - } - - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// contextData - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Func action, Context context) - { - return ExecuteAndCapture((ctx, ct) => action(), context, DefaultCancellationToken); - } - /// /// Executes the specified action within the policy and returns the captured result. /// @@ -241,35 +150,6 @@ public PolicyResult ExecuteAndCapture(Func return ExecuteAndCapture((ctx, ct) => action(ct), new Context(), cancellationToken); } - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Arbitrary data that is passed to the exception policy. - /// The cancellation token. - /// The captured result - /// contextData - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Func action, IDictionary contextData, CancellationToken cancellationToken) - { - return ExecuteAndCapture((ctx, ct) => action(ct), new Context(contextData), cancellationToken); - } - - /// - /// Executes the specified action within the policy and returns the captured result. - /// - /// The action to perform. - /// Context data that is passed to the exception policy. - /// The cancellation token. - /// The captured result - [DebuggerStepThrough] - [Obsolete("This overload is deprecated and scheduled for removal in Polly v6.")] - public PolicyResult ExecuteAndCapture(Func action, Context context, CancellationToken cancellationToken) - { - return ExecuteAndCapture((ctx, ct) => action(ct), context, cancellationToken); - } - /// /// Executes the specified action within the policy and returns the captured result. /// diff --git a/src/Polly.SharedSpecs/Fallback/FallbackTResultAsyncSpecs.cs b/src/Polly.SharedSpecs/Fallback/FallbackTResultAsyncSpecs.cs index 4e6ce50eff7..3be79356b05 100644 --- a/src/Polly.SharedSpecs/Fallback/FallbackTResultAsyncSpecs.cs +++ b/src/Polly.SharedSpecs/Fallback/FallbackTResultAsyncSpecs.cs @@ -378,7 +378,7 @@ public async Task Should_call_onFallback_with_the_passed_context_when_execute_an .HandleResult(ResultPrimitive.Fault) .FallbackAsync(fallbackAction, onFallbackAsync); - (await fallbackPolicy.ExecuteAndCaptureAsync(() => { return Task.FromResult(ResultPrimitive.Fault); }, + (await fallbackPolicy.ExecuteAndCaptureAsync(ctx => { return Task.FromResult(ResultPrimitive.Fault); }, new { key1 = "value1", key2 = "value2" }.AsDictionary()).ConfigureAwait(false)) .Result.Should().Be(ResultPrimitive.Substitute); diff --git a/src/Polly.SharedSpecs/Helpers/ContextualPolicyTResultExtensionsAsync.cs b/src/Polly.SharedSpecs/Helpers/ContextualPolicyTResultExtensionsAsync.cs index 3611d7d36d9..1f6b0282c99 100644 --- a/src/Polly.SharedSpecs/Helpers/ContextualPolicyTResultExtensionsAsync.cs +++ b/src/Polly.SharedSpecs/Helpers/ContextualPolicyTResultExtensionsAsync.cs @@ -41,7 +41,7 @@ public static Task> RaiseResultSequenceOnExecuteAndCapture { var enumerator = resultsToRaise.GetEnumerator(); - return policy.ExecuteAndCaptureAsync(() => + return policy.ExecuteAndCaptureAsync(ctx => { if (!enumerator.MoveNext()) { diff --git a/src/Polly.nuspec b/src/Polly.nuspec index 4d2ddfbd967..263bad60ebb 100644 --- a/src/Polly.nuspec +++ b/src/Polly.nuspec @@ -4,7 +4,7 @@ App vNext Michael Wolfenden, App vNext - Polly is a .NET 4.5 / .NET Standard 1.1 library that allows developers to express resilience and transient fault handling policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation and Fallback in a fluent and thread-safe manner. + Polly is a .NET Standard 1.1 and .NET Standard 2.0 library that allows developers to express resilience and transient fault handling policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation and Fallback in a fluent and thread-safe manner. en-US https://raw.github.com/App-vNext/Polly/master/LICENSE.txt @@ -13,7 +13,16 @@ Exception Handling Resilience Transient Fault Policy Circuit Breaker CircuitBreaker Retry Wait Cache Cache-aside Bulkhead Fallback Timeout Throttle Parallelization Copyright © 2018, App vNext - v5.0 is a major release with significant new resilience policies: Timeout; Bulkhead Isolation; Fallback; Cache; and PolicyWrap. See release notes back to v5.0.0 for full details. + 6.0.1 + - Version 6 RTM, for integration to ASPNET Core 2.1 IHttpClientFactory + + 6.0.0-v6alpha + --------------------- + - Publish as strong-named package only (discontinue non-strong-named versions) + - Add .NetStandard 2.0 tfm + - Provide .NET4.5 support via .NetStandard 1.1 tfm + - Discontinue .NET4.0 support + - Remove methods marked as deprecated in v5.9.0 5.9.0 --------------------- @@ -226,10 +235,10 @@ - Allow arbitrary data to be passed to policy execution - + diff --git a/src/Polly.sln b/src/Polly.sln index e0871edbbcc..9a27f218d0c 100644 --- a/src/Polly.sln +++ b/src/Polly.sln @@ -12,51 +12,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Polly.Shared", "Polly.Shared\Polly.Shared.shproj", "{23FA87F9-C77D-4C67-A0B0-2901DE51B3FF}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Net45", "Polly.Net45\Polly.Net45.csproj", "{29265540-F724-4324-9321-643A0FCB133F}" -EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Polly.SharedSpecs", "Polly.SharedSpecs\Polly.SharedSpecs.shproj", "{8D537C37-A4A2-4BE1-84BC-34F1AFB51CA8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Net45.Specs", "Polly.Net45.Specs\Polly.Net45.Specs.csproj", "{5F2BD87D-A7ED-433D-B7E3-F3072D07C1DC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.NetStandard11", "Polly.NetStandard11\Polly.NetStandard11.csproj", "{5017174E-DAC5-4408-AB15-1F902F40C612}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Net40Async", "Polly.Net40Async\Polly.Net40Async.csproj", "{D6A676C2-982D-42D1-AD21-FA53582A1C31}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.NetStandard11.Specs", "Polly.NetStandard11.Specs\Polly.NetStandard11.Specs.csproj", "{615C92EC-5921-40F4-A690-C66B1587C08E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Net40Async.Specs", "Polly.Net40Async.Specs\Polly.Net40Async.Specs.csproj", "{65062661-9E19-4FC6-859C-8B7811553E13}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.NetStandard20", "Polly.NetStandard20\Polly.NetStandard20.csproj", "{E43A312E-3324-4DB3-8707-6F2335F66CD1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.NetStandard11", "Polly.NetStandard11\Polly.NetStandard11.csproj", "{5017174E-DAC5-4408-AB15-1F902F40C612}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.NetStandard11.Specs", "Polly.NetStandard11.Specs\Polly.NetStandard11.Specs.csproj", "{615C92EC-5921-40F4-A690-C66B1587C08E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.NetStandard20.Specs", "Polly.NetStandard20.Specs\Polly.NetStandard20.Specs.csproj", "{AD51A3D7-01A9-4E41-966B-1A7BAA38A261}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution Polly.Shared\Polly.Shared.projitems*{23fa87f9-c77d-4c67-a0b0-2901de51b3ff}*SharedItemsImports = 13 - Polly.Shared\Polly.Shared.projitems*{29265540-f724-4324-9321-643a0fcb133f}*SharedItemsImports = 4 Polly.Shared\Polly.Shared.projitems*{5017174e-dac5-4408-ab15-1f902f40c612}*SharedItemsImports = 4 - Polly.SharedSpecs\Polly.SharedSpecs.projitems*{5f2bd87d-a7ed-433d-b7e3-f3072d07c1dc}*SharedItemsImports = 4 - Polly.SharedSpecs\Polly.SharedSpecs.projitems*{65062661-9e19-4fc6-859c-8b7811553e13}*SharedItemsImports = 4 Polly.SharedSpecs\Polly.SharedSpecs.projitems*{8d537c37-a4a2-4be1-84bc-34f1afb51ca8}*SharedItemsImports = 13 - Polly.Shared\Polly.Shared.projitems*{d6a676c2-982d-42d1-ad21-fa53582a1c31}*SharedItemsImports = 4 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {29265540-F724-4324-9321-643A0FCB133F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {29265540-F724-4324-9321-643A0FCB133F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {29265540-F724-4324-9321-643A0FCB133F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {29265540-F724-4324-9321-643A0FCB133F}.Release|Any CPU.Build.0 = Release|Any CPU - {5F2BD87D-A7ED-433D-B7E3-F3072D07C1DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F2BD87D-A7ED-433D-B7E3-F3072D07C1DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F2BD87D-A7ED-433D-B7E3-F3072D07C1DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5F2BD87D-A7ED-433D-B7E3-F3072D07C1DC}.Release|Any CPU.Build.0 = Release|Any CPU - {D6A676C2-982D-42D1-AD21-FA53582A1C31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6A676C2-982D-42D1-AD21-FA53582A1C31}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D6A676C2-982D-42D1-AD21-FA53582A1C31}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D6A676C2-982D-42D1-AD21-FA53582A1C31}.Release|Any CPU.Build.0 = Release|Any CPU - {65062661-9E19-4FC6-859C-8B7811553E13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {65062661-9E19-4FC6-859C-8B7811553E13}.Debug|Any CPU.Build.0 = Debug|Any CPU - {65062661-9E19-4FC6-859C-8B7811553E13}.Release|Any CPU.ActiveCfg = Release|Any CPU - {65062661-9E19-4FC6-859C-8B7811553E13}.Release|Any CPU.Build.0 = Release|Any CPU {5017174E-DAC5-4408-AB15-1F902F40C612}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5017174E-DAC5-4408-AB15-1F902F40C612}.Debug|Any CPU.Build.0 = Debug|Any CPU {5017174E-DAC5-4408-AB15-1F902F40C612}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -65,8 +41,19 @@ Global {615C92EC-5921-40F4-A690-C66B1587C08E}.Debug|Any CPU.Build.0 = Debug|Any CPU {615C92EC-5921-40F4-A690-C66B1587C08E}.Release|Any CPU.ActiveCfg = Release|Any CPU {615C92EC-5921-40F4-A690-C66B1587C08E}.Release|Any CPU.Build.0 = Release|Any CPU + {E43A312E-3324-4DB3-8707-6F2335F66CD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E43A312E-3324-4DB3-8707-6F2335F66CD1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E43A312E-3324-4DB3-8707-6F2335F66CD1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E43A312E-3324-4DB3-8707-6F2335F66CD1}.Release|Any CPU.Build.0 = Release|Any CPU + {AD51A3D7-01A9-4E41-966B-1A7BAA38A261}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD51A3D7-01A9-4E41-966B-1A7BAA38A261}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD51A3D7-01A9-4E41-966B-1A7BAA38A261}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD51A3D7-01A9-4E41-966B-1A7BAA38A261}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2E5D54CD-770A-4345-B585-1848FC2EA6F4} + EndGlobalSection EndGlobal