File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,9 @@ internal uint Status
136
136
// cancel request.
137
137
internal void Cancel ( object caller )
138
138
{
139
+ Debug . Assert ( caller != null , "Null caller for Cancel!" ) ;
140
+ Debug . Assert ( caller is SqlCommand || caller is SqlDataReader , "Calling API with invalid caller type: " + caller . GetType ( ) ) ;
141
+
139
142
bool hasLock = false ;
140
143
try
141
144
{
@@ -147,8 +150,7 @@ internal void Cancel(object caller)
147
150
{ // Lock for the time being - since we need to synchronize the attention send.
148
151
// This lock is also protecting against concurrent close and async continuations
149
152
150
- // don't allow objectID -1 since it is reserved for 'not associated with a command'
151
- // yes, the 2^32-1 comand won't cancel - but it also won't cancel when we don't want it
153
+ // Ensure that, once we have the lock, that we are still the owner
152
154
if ( ( ! _cancelled ) && ( _cancellationOwner . Target == caller ) )
153
155
{
154
156
_cancelled = true ;
You can’t perform that action at this time.
0 commit comments