Skip to content
Closed
Show file tree
Hide file tree
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 @@ -462,11 +462,7 @@ public async Task DisposeAsync_DoesNotHang_WhenOwnsSessionIsFalse()

// This should not hang. The issue reports that DisposeAsync hangs indefinitely
// when OwnsSession is false. Use a timeout to detect the hang.
var disposeTask = client.DisposeAsync().AsTask();
var completedTask = await Task.WhenAny(disposeTask, Task.Delay(TimeSpan.FromSeconds(10), TestContext.Current.CancellationToken));

Assert.True(disposeTask == completedTask, "DisposeAsync hung when OwnsSession was false.");
await disposeTask; // Observe any exceptions
await client.DisposeAsync().AsTask().WaitAsync(TimeSpan.FromSeconds(10), TestContext.Current.CancellationToken);
}

[Fact]
Expand Down Expand Up @@ -530,10 +526,6 @@ public async Task DisposeAsync_DoesNotHang_WhenOwnsSessionIsFalse_WithUnsolicite
await Task.Delay(100, TestContext.Current.CancellationToken);

// Dispose should still not hang
var disposeTask = client.DisposeAsync().AsTask();
var completedTask = await Task.WhenAny(disposeTask, Task.Delay(TimeSpan.FromSeconds(10), TestContext.Current.CancellationToken));

Assert.True(disposeTask == completedTask, "DisposeAsync hung when OwnsSession was false after receiving unsolicited messages.");
await disposeTask;
await client.DisposeAsync().AsTask().WaitAsync(TimeSpan.FromSeconds(10), TestContext.Current.CancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,7 @@ public async Task DisposeAsync_DoesNotHang_WhenOwnsSessionIsFalse_WithActiveGetS
await getRequestReceived.Task.WaitAsync(TestConstants.DefaultTimeout, TestContext.Current.CancellationToken);

// Dispose should not hang even though the GET stream is actively open
var disposeTask = client.DisposeAsync().AsTask();
var completedTask = await Task.WhenAny(disposeTask, Task.Delay(TimeSpan.FromSeconds(10), TestContext.Current.CancellationToken));

Assert.True(disposeTask == completedTask, "DisposeAsync hung with OwnsSession=false and active GET stream.");
await disposeTask;
await client.DisposeAsync().AsTask().WaitAsync(TimeSpan.FromSeconds(10), TestContext.Current.CancellationToken);
}
}

Expand Down