File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -78,13 +78,13 @@ public static bool UseCompatibilityProcessSni
7878 {
7979 if ( s_useCompatibilityProcessSni == Tristate . NotInitialized )
8080 {
81- if ( AppContext . TryGetSwitch ( UseCompatibilityProcessSniString , out bool returnedValue ) && returnedValue )
81+ if ( AppContext . TryGetSwitch ( UseCompatibilityProcessSniString , out bool returnedValue ) && ! returnedValue )
8282 {
83- s_useCompatibilityProcessSni = Tristate . True ;
83+ s_useCompatibilityProcessSni = Tristate . False ;
8484 }
8585 else
8686 {
87- s_useCompatibilityProcessSni = Tristate . False ;
87+ s_useCompatibilityProcessSni = Tristate . True ;
8888 }
8989 }
9090 return s_useCompatibilityProcessSni == Tristate . True ;
Original file line number Diff line number Diff line change @@ -3207,7 +3207,13 @@ internal void ReadSni(TaskCompletionSource<object> completion)
32073207 }
32083208 }
32093209 else
3210- {
3210+ {
3211+ // this call to IncrementPendingCallbacks is required for balance
3212+ // the _pendingCallbacks counter will be unconditionally decremented in ReadAsyncCallback
3213+ // so we must make sure that even though we are not making a network call that we do
3214+ // not cause an incorrect decrement which will cause disconnection from the native
3215+ // component
3216+ IncrementPendingCallbacks ( ) ;
32113217 readPacket = default ;
32123218 error = TdsEnums . SNI_SUCCESS ;
32133219 }
You can’t perform that action at this time.
0 commit comments