Skip to content
Merged
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 @@ -60,6 +60,7 @@ public async Task Dispose_PendingReadAsync_ThrowsODE(bool bufferedRead)
using CancellationTokenSource cts = new CancellationTokenSource();
cts.CancelAfter(TestConfiguration.PassingTestTimeout);


(SslStream client, SslStream server) = TestHelper.GetConnectedSslStreams(leaveInnerStreamOpen: true);
using (client)
using (server)
Expand Down Expand Up @@ -113,8 +114,7 @@ public async Task Dispose_ParallelWithHandshake_ThrowsODE()

await Parallel.ForEachAsync(System.Linq.Enumerable.Range(0, 10000), cts.Token, async (i, token) =>
{
// use real Tcp streams to avoid specific behavior of ConnectedStreams when concurrently disposed
(Stream clientStream, Stream serverStream) = TestHelper.GetConnectedTcpStreams();
(Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams();

using SslStream client = new SslStream(clientStream);
using SslStream server = new SslStream(serverStream);
Expand Down Expand Up @@ -149,6 +149,11 @@ static async Task ValidateExceptionAsync(Task task)
{
await task;
}
catch (InvalidOperationException ex) when (ex.StackTrace?.Contains("System.IO.StreamBuffer.WriteAsync") ?? true)
{
// Writing to a disposed ConnectedStream (test only, does not happen with NetworkStream)
return;
}
catch (Exception ex) when (ex
is ObjectDisposedException // disposed locally
or IOException // disposed remotely (received unexpected EOF)
Expand Down
Loading