NegotiateStream and SslStream allow successive Begin operations

Error cases on security streams are handled differently, and successive calls to BeginAuthenticateAsServer or BeginAuthenticateAsClient may no longer fail.

Version introduced

5.0

Change description

In previous .NET versions, calling BeginAuthenticateAsServer or BeginAuthenticateAsClient successively without first calling EndAuthenticateAsServer or EndAuthenticateAsClient results in a NotSupportedException. Starting in .NET 5, successive calls to BeginAuthenticateAsServer or BeginAuthenticateAsClient no longer result in a NotSupportedException, because these APIs are backed by a Task-based implementation.

Reason for change

Switching the internal implementation from asynchronous programming model (APM) to Task-based improves performance and decreases code complexity.

No action is required on the part of the developer.

Affected APIs