Skip to content

Commit

Permalink
Await pending client authentication task before disposing (#66682)
Browse files Browse the repository at this point in the history
Fixes #65455.

The assert was hit due to the SslStream being disposed during handshake, while `AuthenticateAsClientAsync` was still running. This removes a rare crash in test runs with debug libraries configuration.
  • Loading branch information
rzikm authored Mar 16, 2022
1 parent a5f3f96 commit 7c89933
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ public async Task SslStream_SendReceiveOverNetworkStream_AuthenticationException
Assert.Contains("SSL_ERROR_SSL", e.InnerException.Message);
Assert.NotNull(e.InnerException.InnerException);
Assert.Contains("protocol", e.InnerException.InnerException.Message);

e = await Assert.ThrowsAsync<AuthenticationException>(() => clientAuthenticationTask);

Assert.NotNull(e.InnerException);
Assert.Contains("SSL_ERROR_SSL", e.InnerException.Message);
Assert.NotNull(e.InnerException.InnerException);
Assert.Contains("protocol", e.InnerException.InnerException.Message);
}
}

Expand Down

0 comments on commit 7c89933

Please sign in to comment.