Repository navigation
Make WinHTTP cancellation test use a synchronized loopback server - #136829
Merged
rzikm merged 2 commits intoNov 2, 2026
Merged
Conversation
Replace the invalid httpbin 40-second delay dependency with a local server that reads the request without sending a response. Cancel only once the request is pending, preserve the exact exception assertions, and run the test in innerloop. Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
MihaZupan
approved these changes
Nov 2, 2026
…ests/WinHttpHandlerTest.cs Co-authored-by: Miha Zupan <[email protected]>
MihaZupan
approved these changes
Nov 2, 2026
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.
The cancellation test assumes httpbin's
delay=40request is still pending when it cancels after 500 ms. That URL now returns HTTP 400 withinvalid delay: duration 40s longer than 10s; native WinHTTP received it locally in 345 ms. A completed HTTP response makes the existing exception assertion fail, and the unmodified source test reproduced the CI signature on both target frameworks.Use the existing loopback server and cancel after it has read the request, without sending a response. This removes the external dependency and fixed delay while preserving the exact
AggregateExceptionand innerTaskCanceledExceptionassertions. The test can now run in innerloop. No product code changes.The recent CI burst has historical identical failures. The endpoint's change date and actual CI responses were not captured, so this does not establish a newly introduced WinHTTP product regression.
Validation
Commands ran through an owned short
substpath against locally built sources:build.cmd clr+libs -rc release: passed, 0 warnings and 0 errors.dotnet.cmd build src\libraries\System.Net.Http.WinHttpHandler\tests\FunctionalTests\System.Net.Http.WinHttpHandler.Functional.Tests.csproj /t:Test /p:RuntimeConfiguration=Release /p:OuterLoop=true /p:XunitMethodName=System.Net.Http.WinHttpHandlerFunctional.Tests.WinHttpHandlerTest.SendAsync_SlowServerAndCancel_ThrowsTaskCanceledException: before the fix, failed with the identical no-exception assertion on net12.0-windows and net481, one test each.dotnet.cmd build src\libraries\System.Net.Http.WinHttpHandler\tests\FunctionalTests\System.Net.Http.WinHttpHandler.Functional.Tests.csproj /t:Test /p:RuntimeConfiguration=Release /p:XunitMethodName=System.Net.Http.WinHttpHandlerFunctional.Tests.WinHttpHandlerTest.SendAsync_SlowServerAndCancel_ThrowsTaskCanceledException: after the fix, passed on both frameworks, one test each, no skips.dotnet.cmd build src\libraries\System.Net.Http.WinHttpHandler\tests\FunctionalTests\System.Net.Http.WinHttpHandler.Functional.Tests.csproj /t:Test /p:RuntimeConfiguration=Release: passed; net12.0-windows had 1,743 passed and 43 skipped, net481 had 653 passed and 29 skipped, no failures.dotnet.cmd build src\libraries\System.Net.Http.WinHttpHandler\tests\UnitTests\System.Net.Http.WinHttpHandler.Unit.Tests.csproj /t:Test /p:RuntimeConfiguration=Release: passed, 173 tests, no failures or skips.Full external-server outerloop, other Windows versions/architectures, and Mono validation were not run.
Note
This pull request description and code change were generated with GitHub Copilot.