Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
01ccd49
Update to .NET 11 preview 1
martincostello Feb 13, 2026
274386a
Update .NET SDK (#2975)
polly-updater-bot[bot] Mar 10, 2026
bb2d994
Update to .NET 11 preview 2
martincostello Mar 10, 2026
e86b66e
Merge branch 'main' into dotnet-vnext
martincostello Mar 11, 2026
e8bf686
Fix mutation tests
martincostello Mar 11, 2026
e19cda2
Fix native AoT tests on Linux
martincostello Mar 12, 2026
7bcfcb7
Fix build
martincostello Mar 12, 2026
a8d6a6c
Merge branch 'main' into dotnet-vnext
martincostello Mar 13, 2026
fbc66ff
Merge branch 'main' into dotnet-vnext
martincostello Mar 19, 2026
1dec9da
Merge branch 'main' into dotnet-vnext
martincostello Apr 3, 2026
664d641
Merge branch 'main' into dotnet-vnext
martincostello Apr 3, 2026
3de65d1
Update .NET SDK (#3026)
polly-updater-bot[bot] Apr 14, 2026
c90c19c
Fix CS8629 warnings
martincostello Apr 14, 2026
039564b
Remove workaround
martincostello Apr 14, 2026
203d4cd
Merge branch 'main' into dotnet-vnext
martincostello Apr 14, 2026
82a6f54
Merge branch 'main' into dotnet-vnext
martincostello Apr 23, 2026
4faecf2
Merge branch 'main' into dotnet-vnext
martincostello Apr 24, 2026
a8d3a96
Merge branch 'main' into dotnet-vnext
martincostello May 12, 2026
550d1c1
Update to .NET 11 preview 4 (#3066)
martincostello May 12, 2026
cd1da57
Merge branch 'main' into dotnet-vnext
martincostello May 13, 2026
2c405df
Merge branch 'main' into dotnet-vnext
martincostello Jun 7, 2026
9923b84
Fix build
martincostello Jun 7, 2026
8b6971c
Update to .NET 11 preview 5 (#3107)
martincostello Jun 9, 2026
07189dc
Merge branch 'main' into dotnet-vnext
martincostello Jun 9, 2026
1f04428
Merge branch 'main' into dotnet-vnext
martincostello Jun 10, 2026
7786838
Enable runtime async for tests
martincostello Jun 14, 2026
20c6ef7
Enable CheckSdkVulnerabilities
martincostello Jun 14, 2026
020962f
Fix build
martincostello Jun 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<PackageVersion Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="4.14.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.6.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="10.4.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
<PackageVersion Include="MinVer" Version="7.0.0" />
Expand Down Expand Up @@ -66,4 +66,12 @@
<PackageVersion Update="System.Diagnostics.DiagnosticSource" Version="10.0.0" />
<PackageVersion Update="System.Threading.RateLimiting" Version="10.0.0" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net11.0'))">
<PackageVersion Update="Microsoft.Bcl.TimeProvider" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Update="Microsoft.Extensions.Logging" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Update="Microsoft.Extensions.Logging.Abstractions" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Update="Microsoft.Extensions.Options" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Update="System.Diagnostics.DiagnosticSource" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Update="System.Threading.RateLimiting" Version="11.0.0-preview.5.26302.115" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions bench/Polly.Benchmarks/Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class Cache
private static readonly Policy SyncPolicyHit = Policy.Cache(CacheProvider, TimeSpan.MaxValue);
private static readonly AsyncPolicy AsyncPolicyHit = Policy.CacheAsync(CacheProvider, TimeSpan.MaxValue);

private static readonly Context HitContext = new(nameof(HitContext));
private static readonly Context MissContext = new(nameof(MissContext));
private static readonly Context HitContext = [with(nameof(HitContext))];
private static readonly Context MissContext = [with(nameof(MissContext))];

[GlobalSetup]
public Task GlobalSetup()
Expand Down
4 changes: 2 additions & 2 deletions bench/Polly.Benchmarks/Polly.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net11.0;net10.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ProjectType>Benchmark</ProjectType>
<NoWarn>$(NoWarn);CA1822;IDE0060</NoWarn>
Expand All @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" VersionOverride="10.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" VersionOverride="11.0.0-preview.5.26302.115" />
<ProjectReference Include="..\..\src\Polly\Polly.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion bench/Polly.Core.Benchmarks/Polly.Core.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net11.0;net10.0</TargetFrameworks>
<RootNamespace>Polly</RootNamespace>
<ImplicitUsings>true</ImplicitUsings>
<ProjectType>Benchmark</ProjectType>
Expand Down
2 changes: 1 addition & 1 deletion bench/benchmarks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ if ($Interactive -ne $true) {

$project = Join-Path "Polly.Core.Benchmarks" "Polly.Core.Benchmarks.csproj"

dotnet run --configuration $Configuration --framework net10.0 --project $project $additionalArgs
dotnet run --configuration $Configuration --framework net11.0 --project $project $additionalArgs

exit $LASTEXITCODE
3 changes: 2 additions & 1 deletion eng/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<PropertyGroup>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\Polly.snk</AssemblyOriginatorKeyFile>
<CheckSdkVulnerabilities>true</CheckSdkVulnerabilities>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<LangVersion>preview</LangVersion>
<NuGetAuditMode>direct</NuGetAuditMode>
<SignAssembly>true</SignAssembly>
<PollyStrongNamePublicKey Condition=" '$(SignAssembly)' == 'true' ">0024000004800000940000000602000000240000525341310004000001000100150819e3494f97263a3abdd18e5e0c47b04e6c0ede44a6c51d50b545d403ceeb7cbb32d18dbbbcdd1d88a87d7b73206b126be134b0609c36aa3cb31dd2e47e393293102809b8d77f192f3188618a42e651c14ebf05f8f5b76aa91b431642b23497ed82b65d63791cdaa31d4282a2d6cbabc3fe0745b6b6690c417cabf6a1349c</PollyStrongNamePublicKey>
Expand Down
5 changes: 5 additions & 0 deletions eng/Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>

<!-- TODO Move to common when this is no longer a preview feature -->
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net11.0'))">
<Features>$(Features);runtime-async=on</Features>
</PropertyGroup>

<ItemGroup>
<Using Include="Shouldly" />
<Using Include="Xunit" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "10.0.301",
"version": "11.0.100-preview.5.26302.115",
"allowPrerelease": false
},
"msbuild-sdks": {
Expand Down
2 changes: 1 addition & 1 deletion samples/Chaos/Chaos.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<RootNamespace>Chaos</RootNamespace>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/DependencyInjection/DependencyInjection.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/Extensibility/Extensibility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/GenericPipelines/GenericPipelines.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/Intro.FSharp/Intro.FSharp.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/Intro.VisualBasic/Intro.VisualBasic.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/Intro/Intro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/Retries/Retries.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
24 changes: 12 additions & 12 deletions src/Polly/AsyncPolicy.ExecuteOverloads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public Task ExecuteAsync(Func<Task> action) =>
/// <returns>A <see cref="Task" /> which completes when <see cref="AsyncPolicy"/> is registered.</returns>
[DebuggerStepThrough]
public Task ExecuteAsync(Func<Context, Task> action, IDictionary<string, object> contextData) =>
ExecuteAsync((ctx, _) => action(ctx), new Context(contextData), DefaultCancellationToken, DefaultContinueOnCapturedContext);
ExecuteAsync((ctx, _) => action(ctx), [with(contextData)], DefaultCancellationToken, DefaultContinueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy.
Expand Down Expand Up @@ -52,7 +52,7 @@ public Task ExecuteAsync(Func<CancellationToken, Task> action, CancellationToken
/// <returns>A <see cref="Task" /> which completes when <see cref="AsyncPolicy"/> is registered.</returns>
[DebuggerStepThrough]
public Task ExecuteAsync(Func<Context, CancellationToken, Task> action, IDictionary<string, object> contextData, CancellationToken cancellationToken) =>
ExecuteAsync(action, new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext);
ExecuteAsync(action, [with(contextData)], cancellationToken, DefaultContinueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy.
Expand Down Expand Up @@ -88,7 +88,7 @@ public Task ExecuteAsync(Func<CancellationToken, Task> action, CancellationToken
/// <returns>A <see cref="Task" /> which completes when <see cref="AsyncPolicy"/> is registered.</returns>
[DebuggerStepThrough]
public Task ExecuteAsync(Func<Context, CancellationToken, Task> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) =>
ExecuteAsync(action, new Context(contextData), cancellationToken, continueOnCapturedContext);
ExecuteAsync(action, [with(contextData)], cancellationToken, continueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy.
Expand Down Expand Up @@ -131,7 +131,7 @@ public Task<TResult> ExecuteAsync<TResult>(Func<Task<TResult>> action) =>
/// <returns>The value returned by the action.</returns>
[DebuggerStepThrough]
public Task<TResult> ExecuteAsync<TResult>(Func<Context, Task<TResult>> action, IDictionary<string, object> contextData) =>
ExecuteAsync((ctx, _) => action(ctx), new Context(contextData), DefaultCancellationToken, DefaultContinueOnCapturedContext);
ExecuteAsync((ctx, _) => action(ctx), [with(contextData)], DefaultCancellationToken, DefaultContinueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy and returns the result.
Expand Down Expand Up @@ -165,7 +165,7 @@ public Task<TResult> ExecuteAsync<TResult>(Func<CancellationToken, Task<TResult>
/// <returns>The value returned by the action.</returns>
[DebuggerStepThrough]
public Task<TResult> ExecuteAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken) =>
ExecuteAsync(action, new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext);
ExecuteAsync(action, [with(contextData)], cancellationToken, DefaultContinueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy and returns the result.
Expand Down Expand Up @@ -204,7 +204,7 @@ public Task<TResult> ExecuteAsync<TResult>(Func<CancellationToken, Task<TResult>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="contextData"/> is <see langword="null"/>.</exception>
[DebuggerStepThrough]
public Task<TResult> ExecuteAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) =>
ExecuteAsync(action, new Context(contextData), cancellationToken, continueOnCapturedContext);
ExecuteAsync(action, [with(contextData)], cancellationToken, continueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy and returns the result.
Expand Down Expand Up @@ -251,7 +251,7 @@ public Task<PolicyResult> ExecuteAndCaptureAsync(Func<Task> action) =>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="contextData"/> is <see langword="null"/>.</exception>
[DebuggerStepThrough]
public Task<PolicyResult> ExecuteAndCaptureAsync(Func<Context, Task> action, IDictionary<string, object> contextData) =>
ExecuteAndCaptureAsync((ctx, _) => action(ctx), new Context(contextData), DefaultCancellationToken, DefaultContinueOnCapturedContext);
ExecuteAndCaptureAsync((ctx, _) => action(ctx), [with(contextData)], DefaultCancellationToken, DefaultContinueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy and returns the captured result.
Expand Down Expand Up @@ -283,7 +283,7 @@ public Task<PolicyResult> ExecuteAndCaptureAsync(Func<CancellationToken, Task> a
/// <exception cref="ArgumentNullException">Thrown when <paramref name="contextData"/> is <see langword="null"/>.</exception>
[DebuggerStepThrough]
public Task<PolicyResult> ExecuteAndCaptureAsync(Func<Context, CancellationToken, Task> action, IDictionary<string, object> contextData, CancellationToken cancellationToken) =>
ExecuteAndCaptureAsync(action, new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext);
ExecuteAndCaptureAsync(action, [with(contextData)], cancellationToken, DefaultContinueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy and returns the captured result.
Expand Down Expand Up @@ -319,7 +319,7 @@ public Task<PolicyResult> ExecuteAndCaptureAsync(Func<CancellationToken, Task> a
/// <exception cref="ArgumentNullException">Thrown when <paramref name="contextData"/> is <see langword="null"/>.</exception>
[DebuggerStepThrough]
public Task<PolicyResult> ExecuteAndCaptureAsync(Func<Context, CancellationToken, Task> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) =>
ExecuteAndCaptureAsync(action, new Context(contextData), cancellationToken, continueOnCapturedContext);
ExecuteAndCaptureAsync(action, [with(contextData)], cancellationToken, continueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy and returns the captured result.
Expand Down Expand Up @@ -363,7 +363,7 @@ public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Task<TRe
/// <exception cref="ArgumentNullException">Thrown when <paramref name="contextData"/> is <see langword="null"/>.</exception>
[DebuggerStepThrough]
public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Context, Task<TResult>> action, IDictionary<string, object> contextData) =>
ExecuteAndCaptureAsync((ctx, _) => action(ctx), new Context(contextData), DefaultCancellationToken, DefaultContinueOnCapturedContext);
ExecuteAndCaptureAsync((ctx, _) => action(ctx), [with(contextData)], DefaultCancellationToken, DefaultContinueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy and returns the result.
Expand Down Expand Up @@ -398,7 +398,7 @@ public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Cancella
/// <exception cref="ArgumentNullException">Thrown when <paramref name="contextData"/> is <see langword="null"/>.</exception>
[DebuggerStepThrough]
public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken) =>
ExecuteAndCaptureAsync(action, new Context(contextData), cancellationToken, DefaultContinueOnCapturedContext);
ExecuteAndCaptureAsync(action, [with(contextData)], cancellationToken, DefaultContinueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy and returns the result.
Expand Down Expand Up @@ -437,7 +437,7 @@ public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Cancella
/// <exception cref="ArgumentNullException">Thrown when <paramref name="contextData"/> is <see langword="null"/>.</exception>
[DebuggerStepThrough]
public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync<TResult>(Func<Context, CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext) =>
ExecuteAndCaptureAsync(action, new Context(contextData), cancellationToken, continueOnCapturedContext);
ExecuteAndCaptureAsync(action, [with(contextData)], cancellationToken, continueOnCapturedContext);

/// <summary>
/// Executes the specified asynchronous action within the policy and returns the result.
Expand Down
Loading
Loading