Skip to content
Open
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1117,10 +1117,10 @@ await IgnoreExceptions(async () =>

[Fact]
[OuterLoop]
[ActiveIssue("https://github.com/dotnet/runtime/issues/39056")]
[SkipOnPlatform(TestPlatforms.Android, "Synchronous Send is not supported on Android")]
public async Task Send_TimeoutRequestContent_Throws()
{
var semaphore = new SemaphoreSlim(0);
await LoopbackServer.CreateClientAndServerAsync(
async uri =>
{
Expand All @@ -1146,12 +1146,14 @@ await LoopbackServer.CreateClientAndServerAsync(

TaskCanceledException ex = await Assert.ThrowsAsync<TaskCanceledException>(() => sendTask);
Assert.IsType<TimeoutException>(ex.InnerException);
semaphore.Release();
},
async server =>
{
await server.AcceptConnectionAsync(async connection =>
{
await IgnoreExceptions(connection.ReadRequestDataAsync());
await semaphore.WaitAsync();
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The semaphore wait should include a timeout and assertion to prevent the test from hanging if the client-side assertions fail before releasing the semaphore. The established pattern in this test file is to use Assert.True(await semaphore.WaitAsync(5000), "semaphore timed out") to ensure the test fails fast with a clear message rather than hanging indefinitely. See lines 484, 647, and 717 for examples of this pattern.

Suggested change
await semaphore.WaitAsync();
Assert.True(await semaphore.WaitAsync(5000), "semaphore timed out");

Copilot uses AI. Check for mistakes.
});
});
}
Expand Down
Loading