Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to .NET 9 SDK #2003

Merged
merged 13 commits into from
Nov 12, 2024
9 changes: 7 additions & 2 deletions .github/workflows/actions-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ name: actions-lint

on:
push:
branches: [ main, release/* ]
branches:
- main
- release/*
paths-ignore:
- '**/*.gitattributes'
- '**/*.gitignore'
- '**/*.md'
pull_request:
branches: [ main, release/* ]
branches:
- main
- release/*
- dotnet-vnext
workflow_dispatch:

permissions:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ name: build

on:
push:
branches: [ main, release/* ]
branches:
- main
- release/*
tags: [ '*' ]
pull_request:
branches: [ main, release/* ]
branches:
- main
- release/*
- dotnet-vnext
workflow_dispatch:

env:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ name: dependency-review

on:
pull_request:
branches: [ main, release/* ]
branches:
- main
- release/*
- dotnet-vnext

permissions:
contents: read
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ name: github-pages

on:
push:
branches: [ main, release/* ]
branches:
- main
- release/*
pull_request:
branches: [ main, release/* ]
branches:
- main
- release/*
- dotnet-vnext
workflow_dispatch:

permissions:
Expand All @@ -14,6 +19,7 @@ jobs:

build-docs:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:

Expand All @@ -37,6 +43,8 @@ jobs:
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1

- name: Generate documentation
env:
DOTNET_ROLL_FORWARD: LatestMajor
run: |
dotnet tool restore
dotnet build --configuration Release /p:SKIP_POLLY_ANALYZERS=true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-push-do-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: on-push-do-docs

on:
push:
branches: [main]
branches: [ main ]
paths: [ "src/Snippets/**" ]
workflow_dispatch:

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/updater-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ name: updater-approve

on:
pull_request:
branches: [ main, release/* ]
branches:
- main
- release/*
- dotnet-vnext

permissions:
contents: read
Expand Down
5 changes: 5 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<MicrosoftExtensionsVersion>8.0.0</MicrosoftExtensionsVersion>
<MicrosoftExtensionsTimeProviderVersion>8.7.0</MicrosoftExtensionsTimeProviderVersion>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net9.0'))">
<MicrosoftExtensionsVersion>9.0.0</MicrosoftExtensionsVersion>
<MicrosoftExtensionsTimeProviderVersion>9.0.0</MicrosoftExtensionsTimeProviderVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
Expand Down Expand Up @@ -42,6 +46,7 @@
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="System.Threading.RateLimiting" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
Expand Down
2 changes: 1 addition & 1 deletion 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>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ProjectType>Benchmark</ProjectType>
<NoWarn>$(NoWarn);CA1822;IDE0060</NoWarn>
Expand Down
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>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net9.0;net8.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 net8.0 --project $project $additionalArgs
dotnet run --configuration $Configuration --framework net9.0 --project $project $additionalArgs

exit $LASTEXITCODE
5 changes: 3 additions & 2 deletions eng/Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\Polly.snk</AssemblyOriginatorKeyFile>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<NuGetAuditMode>direct</NuGetAuditMode>
<SignAssembly>true</SignAssembly>
<PollyStrongNamePublicKey Condition=" '$(SignAssembly)' == 'true' ">0024000004800000940000000602000000240000525341310004000001000100150819e3494f97263a3abdd18e5e0c47b04e6c0ede44a6c51d50b545d403ceeb7cbb32d18dbbbcdd1d88a87d7b73206b126be134b0609c36aa3cb31dd2e47e393293102809b8d77f192f3188618a42e651c14ebf05f8f5b76aa91b431642b23497ed82b65d63791cdaa31d4282a2d6cbabc3fe0745b6b6690c417cabf6a1349c</PollyStrongNamePublicKey>
</PropertyGroup>
Expand All @@ -19,12 +20,12 @@
</ItemGroup>

<PropertyGroup Label="MinVer">
<MinVerMinimumMajorMinor>8.4</MinVerMinimumMajorMinor>
<MinVerMinimumMajorMinor>8.5</MinVerMinimumMajorMinor>
</PropertyGroup>

<Target Name="CustomizeVersions" AfterTargets="MinVer" Condition="'$(GITHUB_ACTIONS)' == 'true'">
<PropertyGroup>
<FileVersion>$([MSBuild]::ValueOrDefault('$(MinVerMajor)', '8')).$([MSBuild]::ValueOrDefault('$(MinVerMinor)', '4')).$([MSBuild]::ValueOrDefault('$(MinVerPatch)', '0')).$(GITHUB_RUN_NUMBER)</FileVersion>
<FileVersion>$([MSBuild]::ValueOrDefault('$(MinVerMajor)', '8')).$([MSBuild]::ValueOrDefault('$(MinVerMinor)', '5')).$([MSBuild]::ValueOrDefault('$(MinVerPatch)', '0')).$(GITHUB_RUN_NUMBER)</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="$(GITHUB_REF.StartsWith(`refs/pull/`))">
<PackageVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)-pr.$(GITHUB_REF_NAME.Replace(`/merge`, ``)).$(GITHUB_RUN_NUMBER)</PackageVersion>
Expand Down
2 changes: 1 addition & 1 deletion eng/Library.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<PropertyGroup Label="NuGet package validation">
<EnablePackageValidation Condition="'$(EnablePackageValidation)' == ''">true</EnablePackageValidation>
<PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">8.2.0</PackageValidationBaselineVersion>
<PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">8.4.2</PackageValidationBaselineVersion>
</PropertyGroup>

<PropertyGroup Label="SourceLink">
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": "8.0.403",
"version": "9.0.100",
"allowPrerelease": false,
"rollForward": "latestMajor"
}
Expand Down
3 changes: 2 additions & 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>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>Chaos</RootNamespace>
Expand All @@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Resilience" />
<PackageReference Include="Polly.Core" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

</Project>
3 changes: 2 additions & 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>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -11,6 +11,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Polly.Extensions" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

</Project>
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>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
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>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
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>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
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>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Polly.Core/Hedging/Controller/TaskExecution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public async ValueTask ResetAsync()
_stopExecutionTimestamp = 0;
}

[DebuggerDisableUserUnhandledExceptions]
private async Task ExecuteSecondaryActionAsync(Func<ValueTask<Outcome<T>>> action)
{
Outcome<T> outcome;
Expand All @@ -218,6 +219,7 @@ private async Task ExecuteSecondaryActionAsync(Func<ValueTask<Outcome<T>>> actio

private async Task ExecuteCreateActionException(Exception e) => await UpdateOutcomeAsync(Polly.Outcome.FromException<T>(e)).ConfigureAwait(Context.ContinueOnCapturedContext);

[DebuggerDisableUserUnhandledExceptions]
private async Task ExecutePrimaryActionAsync<TState>(Func<ResilienceContext, TState, ValueTask<Outcome<T>>> primaryCallback, TState state)
{
Outcome<T> outcome;
Expand Down
1 change: 0 additions & 1 deletion src/Polly.Core/Outcome.TResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,4 @@ internal TResult GetResultOrRethrow()
ExceptionDispatchInfo?.Throw();
return Result!;
}

}
4 changes: 4 additions & 0 deletions src/Polly.Core/Polly.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@
<PackageReference Include="System.ComponentModel.Annotations" Condition="!$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'netcoreapp3.1'))" />
</ItemGroup>

<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net9.0'))">
<Compile Include="$(MSBuildThisFileDirectory)..\Shared\DebuggerDisableUserUnhandledExceptionsAttribute.cs" Link="DebuggerDisableUserUnhandledExceptionsAttribute.cs" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions src/Polly.Core/ResilienceContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ internal void InitializeFrom(ResilienceContext context, CancellationToken cancel
Properties.AddOrReplaceProperties(context.Properties);
}

#pragma warning disable S3236 // Remove this argument from the method call; it hides the caller information.
[ExcludeFromCodeCoverage]
[Conditional("DEBUG")]
internal void AssertInitialized() => Debug.Assert(IsInitialized, "The resilience context is not initialized.");
#pragma warning restore S3236 // Remove this argument from the method call; it hides the caller information.

internal ResilienceContext Initialize<TResult>(bool isSynchronous)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Polly.Core/ResiliencePipeline.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async ValueTask ExecuteAsync<TState>(
InitializeAsyncContext(context);

var outcome = await Component.ExecuteCore(
static async (context, state) =>
[DebuggerDisableUserUnhandledExceptions] static async (context, state) =>
{
try
{
Expand Down Expand Up @@ -60,7 +60,7 @@ public async ValueTask ExecuteAsync(
InitializeAsyncContext(context);

var outcome = await Component.ExecuteCore(
static async (context, state) =>
[DebuggerDisableUserUnhandledExceptions] static async (context, state) =>
{
try
{
Expand Down Expand Up @@ -99,7 +99,7 @@ public async ValueTask ExecuteAsync<TState>(
try
{
var outcome = await Component.ExecuteCore(
static async (context, state) =>
[DebuggerDisableUserUnhandledExceptions] static async (context, state) =>
{
try
{
Expand Down Expand Up @@ -140,7 +140,7 @@ public async ValueTask ExecuteAsync(
try
{
var outcome = await Component.ExecuteCore(
static async (context, state) =>
[DebuggerDisableUserUnhandledExceptions] static async (context, state) =>
{
try
{
Expand Down
8 changes: 4 additions & 4 deletions src/Polly.Core/ResiliencePipeline.AsyncT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async ValueTask<TResult> ExecuteAsync<TResult, TState>(
InitializeAsyncContext<TResult>(context);

var outcome = await Component.ExecuteCore(
static async (context, state) =>
[DebuggerDisableUserUnhandledExceptions] static async (context, state) =>
{
try
{
Expand Down Expand Up @@ -88,7 +88,7 @@ public async ValueTask<TResult> ExecuteAsync<TResult>(
InitializeAsyncContext<TResult>(context);

var outcome = await Component.ExecuteCore(
static async (context, state) =>
[DebuggerDisableUserUnhandledExceptions] static async (context, state) =>
{
try
{
Expand Down Expand Up @@ -127,7 +127,7 @@ public async ValueTask<TResult> ExecuteAsync<TResult, TState>(
try
{
var outcome = await Component.ExecuteCore(
static async (context, state) =>
[DebuggerDisableUserUnhandledExceptions] static async (context, state) =>
{
try
{
Expand Down Expand Up @@ -168,7 +168,7 @@ public async ValueTask<TResult> ExecuteAsync<TResult>(
try
{
var outcome = await Component.ExecuteCore(
static async (context, state) =>
[DebuggerDisableUserUnhandledExceptions] static async (context, state) =>
{
try
{
Expand Down
Loading