File tree Expand file tree Collapse file tree 1 file changed +16
-17
lines changed
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -3212,29 +3212,28 @@ internal void ReadSni(TaskCompletionSource<object> completion)
32123212
32133213 readPacket = ReadAsync ( handle , out error ) ;
32143214
3215- if ( ! ( TdsEnums . SNI_SUCCESS == error || TdsEnums . SNI_SUCCESS_IO_PENDING == error ) )
3216- {
3217- DecrementPendingCallbacks ( false ) ; // Failure - we won't receive callback!
3218- }
3215+ if ( ! ( TdsEnums . SNI_SUCCESS == error || TdsEnums . SNI_SUCCESS_IO_PENDING == error ) )
3216+ {
3217+ DecrementPendingCallbacks ( false ) ; // Failure - we won't receive callback!
32193218 }
32203219 }
3221- else
3222- {
3223- // this call to IncrementPendingCallbacks is required for balance
3224- // the _pendingCallbacks counter will be unconditionally decremented in ReadAsyncCallback
3225- // so we must make sure that even though we are not making a network call that we do
3226- // not cause an incorrect decrement which will cause disconnection from the native
3227- // component
3228- IncrementPendingCallbacks ( ) ;
3229- readPacket = default ;
3230- error = TdsEnums . SNI_SUCCESS ;
3231- }
32323220 }
3233- finally
3221+ else
32343222 {
3235- Interlocked . Decrement ( ref _readingCount ) ;
3223+ // this call to IncrementPendingCallbacks is required for balance
3224+ // the _pendingCallbacks counter will be unconditionally decremented in ReadAsyncCallback
3225+ // so we must make sure that even though we are not making a network call that we do
3226+ // not cause an incorrect decrement which will cause disconnection from the native
3227+ // component
3228+ IncrementPendingCallbacks ( ) ;
3229+ readPacket = default ;
3230+ error = TdsEnums . SNI_SUCCESS ;
32363231 }
32373232 }
3233+ finally
3234+ {
3235+ Interlocked . Decrement ( ref _readingCount ) ;
3236+ }
32383237
32393238 if ( handle . IsNull )
32403239 {
You can’t perform that action at this time.
0 commit comments