From 2ff91f672088082506ca4dd3b603b58a17ce53ad Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 4 Nov 2019 09:55:44 -0500 Subject: [PATCH] Fix SNIPacket.ReadFromStreamAsync to not consume same ValueTask twice --- .../src/Microsoft/Data/SqlClient/SNI/SNIPacket.NetCoreApp.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIPacket.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIPacket.NetCoreApp.cs index 0c79d10355..e6a35caeda 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIPacket.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIPacket.NetCoreApp.cs @@ -58,6 +58,11 @@ async Task ReadFromStreamAsync(SNIPacket packet, SNIAsyncCallback cb, ValueTask< // Completed return; } + else + { + // Avoid consuming the same instance twice. + vt = new ValueTask(_length); + } } // Not complete or error call the async local function to complete