HttpClient default and per request timeout: retarget net10.0, add timeout-vs-cancellation and resilience samples - #2234
Open
vladimir-pecanac-main wants to merge 1 commit into
Conversation
…d resilience endpoints - Both projects net8.0 to net10.0; web project Nullable enabled. - Test packages: Microsoft.NET.Test.Sdk 18.10.1, xunit 2.9.3, xunit.runner.visualstudio 4.0.0, coverlet.collector 10.0.1, Microsoft.AspNetCore.Mvc.Testing 10.0.12. - Add Microsoft.Extensions.Http.Resilience 10.10.0, a ResilientClient named client with AddStandardResilienceHandler, and /api/test-resilience-timeout. - Add /api/test-timeout-vs-cancellation, which uses an exception filter on the nested TimeoutException. - Two new tests in EndpointsLiveTests, so the CI Live filter still skips them. - Drop the unused container tools package and its Docker properties, AddControllers, MapControllers, UseAuthorization, UseHttpsRedirection and four unused using directives. - Dispose the three HttpResponseMessage locals with using var.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sample update for "Change Default and per Request Timeout in HttpClient" (code-maze.com/aspnetcore-change-default-and-per-request-timeout-in-httpclient/). This PR touches only aspnetcore-features/HttpClientDefaultAndPerRequestTimeOut.
Changes:
Package versions were re-queried on NuGet on 2026-09-23. Microsoft.NET.Test.Sdk is 18.10.1 today, one patch above the 18.10.0 the batch plan named, so 18.10.1 is what this PR uses. xunit 2.9.3, xunit.runner.visualstudio 4.0.0, coverlet.collector 10.0.1, Microsoft.AspNetCore.Mvc.Testing 10.0.12 and Microsoft.Extensions.Http.Resilience 10.10.0 match the plan.
Verified locally on SDK 10.0.302, runtime Microsoft.NETCore.App 10.0.10: dotnet build -c Release with 0 warnings and 0 errors, dotnet test with 6 of 6 passing when the Live tests are run directly, dotnet test --filter "FullyQualifiedName!~Live" exits 0 with no test selected (what CI runs), and dotnet list package --vulnerable --include-transitive clean on both projects. launchSettings.json is unchanged.