diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs index bba4808efd..c8aa34ed54 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs @@ -2356,9 +2356,10 @@ internal TdsOperationStatus TryReadPlpBytes(ref byte[] buff, int offset, int len { // if there is a snapshot which it contains a stored plp buffer take it // and try to use it if it is the right length - buff = TryTakeSnapshotStorage() as byte[]; - if (buff != null) + byte[] existingBuff = TryTakeSnapshotStorage() as byte[]; + if (existingBuff != null) { + buff = existingBuff; totalBytesRead = _snapshot.GetPacketDataOffset(); } }