diff --git a/Polly.sln b/Polly.sln index 8774b5e5340..ee667977d76 100644 --- a/Polly.sln +++ b/Polly.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.Net35", "src\Polly.Net35\Polly.Net35.csproj", "{839C8F41-292D-486C-815B-ACE7F03467E3}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{67DE5201-A735-4C13-B528-488231ED01A8}" @@ -27,6 +29,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{DBE00D EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.Net45", "src\Polly.Net45\Polly.Net45.csproj", "{29265540-F724-4324-9321-643A0FCB133F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.Pcl", "src\Polly.Pcl\Polly.Pcl.csproj", "{905CF38A-BE90-4234-BF15-2FCFD1973A9C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -49,6 +53,10 @@ Global {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 + {905CF38A-BE90-4234-BF15-2FCFD1973A9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {905CF38A-BE90-4234-BF15-2FCFD1973A9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {905CF38A-BE90-4234-BF15-2FCFD1973A9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {905CF38A-BE90-4234-BF15-2FCFD1973A9C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index 81086136d78..a3fad6dda2d 100644 Binary files a/README.md and b/README.md differ diff --git a/src/Polly.Net35/CircuitBreaker/BrokenCircuitException.cs b/src/Polly.Net35/CircuitBreaker/BrokenCircuitException.cs index 05c57662387..e9528d5d2d2 100644 --- a/src/Polly.Net35/CircuitBreaker/BrokenCircuitException.cs +++ b/src/Polly.Net35/CircuitBreaker/BrokenCircuitException.cs @@ -6,7 +6,9 @@ namespace Polly.CircuitBreaker /// /// Exception thrown when a circuit is broken. /// +#if !PORTABLE [Serializable] +#endif public class BrokenCircuitException : Exception { /// @@ -33,6 +35,7 @@ public BrokenCircuitException(string message, Exception inner) : base(message, i { } +#if !PORTABLE /// /// Initializes a new instance of the class. /// @@ -43,5 +46,6 @@ protected BrokenCircuitException( StreamingContext context) : base(info, context) { } +#endif } } \ No newline at end of file diff --git a/src/Polly.Net35/Utilities/SystemClock.cs b/src/Polly.Net35/Utilities/SystemClock.cs index 582734db7bc..7303e60d672 100644 --- a/src/Polly.Net35/Utilities/SystemClock.cs +++ b/src/Polly.Net35/Utilities/SystemClock.cs @@ -1,6 +1,10 @@ using System; using System.Threading; +#if PORTABLE +using System.Threading.Tasks; +#endif + namespace Polly.Utilities { /// @@ -12,8 +16,12 @@ public static class SystemClock /// Allows the setting of a custom Thread.Sleep implementation for testing. /// By default this will be a call to /// +#if !PORTABLE public static Action Sleep = Thread.Sleep; - +#endif +#if PORTABLE + public static Action Sleep = async span => await Task.Delay(span); +#endif /// /// Allows the setting of a custom DateTime.UtcNow implementation for testing. /// By default this will be a call to @@ -26,7 +34,12 @@ public static class SystemClock /// public static void Reset() { - Sleep = Thread.Sleep; +#if !PORTABLE + Sleep = Thread.Sleep; +#endif +#if PORTABLE + Sleep = span => Task.Delay(span); +#endif UtcNow = () => DateTime.UtcNow; } } diff --git a/src/Polly.Net35/Utilities/TimedLock.cs b/src/Polly.Net35/Utilities/TimedLock.cs index 10b14e7381c..1ea06b1e5cb 100644 --- a/src/Polly.Net35/Utilities/TimedLock.cs +++ b/src/Polly.Net35/Utilities/TimedLock.cs @@ -64,7 +64,9 @@ private class Sentinel // If this finalizer runs, someone somewhere failed to // call Dispose, which means we've failed to leave // a monitor! +#if !PORTABLE System.Diagnostics.Debug.Fail("Undisposed lock"); +#endif } } private Sentinel leakDetector; diff --git a/src/Polly.Pcl/Polly.Pcl.csproj b/src/Polly.Pcl/Polly.Pcl.csproj new file mode 100644 index 00000000000..3f9f256eaf7 --- /dev/null +++ b/src/Polly.Pcl/Polly.Pcl.csproj @@ -0,0 +1,121 @@ + + + + + 11.0 + Debug + AnyCPU + {905CF38A-BE90-4234-BF15-2FCFD1973A9C} + Library + Properties + Polly + Polly + v4.5 + Profile78 + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + bin\Debug\ + TRACE;DEBUG;PORTABLE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE;PORTABLE + prompt + 4 + + + false + + + ..\Polly.Net45\Polly.snk + + + + Properties\SolutionAssemblyInfo.cs + + + Properties\SolutionVersion.cs + + + CircuitBreakerSyntax.cs + + + CircuitBreaker\BrokenCircuitException.cs + + + CircuitBreaker\CircuitBreakerPolicy.cs + + + CircuitBreaker\CircuitBreakerState.cs + + + CircuitBreaker\ICircuitBreakerState.cs + + + ContextualPolicy.cs + + + ExceptionPredicate.cs + + + OrSyntax.cs + + + Policy.cs + + + PolicyBuilder.cs + + + RetrySyntax.cs + + + Retry\IRetryPolicyState.cs + + + Retry\RetryPolicy.cs + + + Retry\RetryPolicyState.cs + + + Retry\RetryPolicyStateWithCount.cs + + + Retry\RetryPolicyStateWithSleep.cs + + + Utilities\SystemClock.cs + + + Utilities\TimedLock.cs + + + Context.cs + + + + + + Polly.snk + + + + + \ No newline at end of file diff --git a/src/Polly.Pcl/Properties/AssemblyInfo.cs b/src/Polly.Pcl/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..fd6d276a18a --- /dev/null +++ b/src/Polly.Pcl/Properties/AssemblyInfo.cs @@ -0,0 +1,2 @@ +using System.Reflection; +[assembly: AssemblyTitle("Polly")] \ No newline at end of file diff --git a/src/Polly.Specs/Polly.Specs.csproj b/src/Polly.Specs/Polly.Specs.csproj index 62055dd58e3..57dc512b0bf 100644 --- a/src/Polly.Specs/Polly.Specs.csproj +++ b/src/Polly.Specs/Polly.Specs.csproj @@ -38,7 +38,7 @@ false - true + false Polly.snk @@ -70,14 +70,17 @@ - - {29265540-f724-4324-9321-643a0fcb133f} - Polly.Net45 + + + + + + {905cf38a-be90-4234-bf15-2fcfd1973a9c} + Polly.Pcl - - +