Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Optimize SqlClient SNIPacket async paths #34184

Merged
merged 5 commits into from
Dec 21, 2018

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Dec 20, 2018

For ReadFromStreamAsync(Stream stream, SNIAsyncCallback callback)

await stream.ReadAsync(new Memory<byte>(...))
is a more efficient path than
stream.ReadAsync(byte[], ...).ContinueWith(Task => ...)

Move WriteToStreamAsync(Stream stream, ...) away from being async void

/cc @Wraith2 @saurabh500 @afsanehr @keeratsingh @stephentoub

@benaadams benaadams changed the title Optimize SNIPacket async paths Optimize SqlClient SNIPacket async paths Dec 20, 2018
@saurabh500
Copy link
Contributor

Looks like the netstandard targeted builds of SqlClient are failing. You may need to add the ValueTask specific code in separate files, or #if def them if the #ifdef is small.

System\Data\SqlClient\SNI\SNIPacket.cs(251,83): error CS0246: The type or namespace name 'ValueTask<>' could not be found (are you missing a using directive or an assembly reference?) [D:\j\workspace\windows-TGrou---0d2c9ac4\src\System.Data.SqlClient\src\System.Data.SqlClient.csproj]

@benaadams
Copy link
Member Author

Seemed to do the trick; thank you for your help @saurabh500

picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* Optimize SNIPacket async paths

* Feedback

* NET Core vs NET Std

* csproj

* Feedback


Commit migrated from dotnet/corefx@6870c4e
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants