Assert ValueTask completion in SslStream.Read/Write (dotnet/corefx#42331)
We're employing a pattern in SslStream to avoid redundant code: we reuse the same code paths for both sync and async operations, with different interface implementations for each. The sync implementation has implementations that complete synchronously, and we then guarantee that the whole operation actually completes synchronously, even though it's implemented with async methods. We then .GetAwaiter().GetResult() to extract the result. Since by construction the task will have already completed, it's ok to do so, but it's difficult for a human to see this, and harder for an analyzer. Add an assert to both convey to an analyzer that we know what we're doing, and add a message for a human to understand it better. We can also remove an unnecessary "AsTask()" operation from the synchronous Write path, which should also remove a tiny bit of overhead.
Commit migrated from https://github.com/dotnet/corefx/commit/
d301036132d052840636232005797f86d6363976