@@ -72,7 +72,7 @@ internal sealed class ExecuteNonQueryAsyncCallContext : AAsyncCallContext<SqlCom
7272
7373            public  TaskCompletionSource < int >  TaskCompletionSource  =>  _source ; 
7474
75-             public  void  Set ( SqlCommand  command ,  TaskCompletionSource < int >  source ,  CancellationTokenRegistration  disposable ,    Guid  operationID ) 
75+             public  void  Set ( SqlCommand  command ,  TaskCompletionSource < int >  source ,  CancellationTokenRegistration  disposable ,  Guid  operationID ) 
7676            { 
7777                base . Set ( command ,  source ,  disposable ) ; 
7878                OperationID  =  operationID ; 
@@ -250,9 +250,9 @@ internal bool IsColumnEncryptionEnabled
250250            } 
251251        } 
252252
253-         internal  bool  ShouldUseEnclaveBasedWorkflow  =>   
254-             ( ! string . IsNullOrWhiteSpace ( _activeConnection . EnclaveAttestationUrl )  ||  Connection . AttestationProtocol  ==  SqlConnectionAttestationProtocol . None )  &&   
255-                     IsColumnEncryptionEnabled ;   
253+         internal  bool  ShouldUseEnclaveBasedWorkflow  => 
254+             ( ! string . IsNullOrWhiteSpace ( _activeConnection . EnclaveAttestationUrl )  ||  Connection . AttestationProtocol  ==  SqlConnectionAttestationProtocol . None )  && 
255+                     IsColumnEncryptionEnabled ; 
256256
257257        /// <summary> 
258258        /// Per-command custom providers. It can be provided by the user and can be set more than once.  
@@ -1319,13 +1319,13 @@ private IAsyncResult BeginExecuteNonQueryInternal(CommandBehavior behavior, Asyn
13191319                // In these cases finalize the call internally and trigger a retry when needed. 
13201320                if  ( 
13211321                    ! TriggerInternalEndAndRetryIfNecessary ( 
1322-                         behavior ,   
1323-                         stateObject ,   
1324-                         timeout ,   
1325-                         usedCache ,   
1326-                         inRetry ,   
1327-                         asyncWrite ,   
1328-                         globalCompletion ,   
1322+                         behavior , 
1323+                         stateObject , 
1324+                         timeout , 
1325+                         usedCache , 
1326+                         inRetry , 
1327+                         asyncWrite , 
1328+                         globalCompletion , 
13291329                        localCompletion , 
13301330                        endFunc :  static  ( SqlCommand  command ,  IAsyncResult  asyncResult ,  bool  isInternal ,  string  endMethod )  => 
13311331                        { 
@@ -1607,9 +1607,9 @@ private object InternalEndExecuteNonQuery(IAsyncResult asyncResult, bool isInter
16071607                    { 
16081608                        bool  dataReady ; 
16091609                        Debug . Assert ( _stateObj . _syncOverAsync ,  "Should not attempt pends in a synchronous call" ) ; 
1610-                         bool  result  =  _stateObj . Parser . TryRun ( RunBehavior . UntilDone ,  this ,  null ,  null ,  _stateObj , 
1610+                         TdsOperationStatus  result  =  _stateObj . Parser . TryRun ( RunBehavior . UntilDone ,  this ,  null ,  null ,  _stateObj , 
16111611                            out  dataReady ) ; 
1612-                         if  ( ! result ) 
1612+                         if  ( result   !=   TdsOperationStatus . Done ) 
16131613                        { 
16141614                            throw  SQL . SynchronousCallMayNotPend ( ) ; 
16151615                        } 
@@ -1849,13 +1849,13 @@ private IAsyncResult BeginExecuteXmlReaderInternal(CommandBehavior behavior, Asy
18491849                // In these cases finalize the call internally and trigger a retry when needed. 
18501850                if  ( 
18511851                    ! TriggerInternalEndAndRetryIfNecessary ( 
1852-                         behavior ,   
1853-                         stateObject ,   
1854-                         timeout ,   
1855-                         usedCache ,   
1856-                         inRetry ,   
1857-                         asyncWrite ,   
1858-                         globalCompletion ,   
1852+                         behavior , 
1853+                         stateObject , 
1854+                         timeout , 
1855+                         usedCache , 
1856+                         inRetry , 
1857+                         asyncWrite , 
1858+                         globalCompletion , 
18591859                        localCompletion , 
18601860                        endFunc :  static  ( SqlCommand  command ,  IAsyncResult  asyncResult ,  bool  isInternal ,  string  endMethod )  => 
18611861                        { 
@@ -2295,13 +2295,13 @@ private IAsyncResult BeginExecuteReaderInternal(CommandBehavior behavior, AsyncC
22952295                // In these cases finalize the call internally and trigger a retry when needed. 
22962296                if  ( 
22972297                    ! TriggerInternalEndAndRetryIfNecessary ( 
2298-                         behavior ,   
2299-                         stateObject ,   
2300-                         timeout ,   
2301-                         usedCache ,   
2302-                         inRetry ,   
2303-                         asyncWrite ,   
2304-                         globalCompletion ,   
2298+                         behavior , 
2299+                         stateObject , 
2300+                         timeout , 
2301+                         usedCache , 
2302+                         inRetry , 
2303+                         asyncWrite , 
2304+                         globalCompletion , 
23052305                        localCompletion , 
23062306                        endFunc :  static  ( SqlCommand  command ,  IAsyncResult  asyncResult ,  bool  isInternal ,  string  endMethod )  => 
23072307                        { 
@@ -2898,7 +2898,7 @@ private Task<object> InternalExecuteScalarAsync(CancellationToken cancellationTo
28982898                                // exception thrown by Dispose... 
28992899                                source . SetException ( e ) ; 
29002900                            } 
2901-                         } ,   
2901+                         } , 
29022902                        TaskScheduler . Default 
29032903                    ) ; 
29042904                } 
@@ -2972,7 +2972,7 @@ internal Task<object> ExecuteScalarBatchAsync(CancellationToken cancellationToke
29722972                                // exception thrown by Dispose... 
29732973                                source . SetException ( e ) ; 
29742974                            } 
2975-                         } ,   
2975+                         } , 
29762976                        TaskScheduler . Default 
29772977                    ) ; 
29782978                } 
@@ -3682,9 +3682,11 @@ private Task RunExecuteNonQueryTds(string methodName, bool isAsync, int timeout,
36823682                { 
36833683                    bool  dataReady ; 
36843684                    Debug . Assert ( _stateObj . _syncOverAsync ,  "Should not attempt pends in a synchronous call" ) ; 
3685-                     bool  result  =  _stateObj . Parser . TryRun ( RunBehavior . UntilDone ,  this ,  null ,  null ,  _stateObj ,  out  dataReady ) ; 
3686-                     if  ( ! result ) 
3687-                     {  throw  SQL . SynchronousCallMayNotPend ( ) ;  } 
3685+                     TdsOperationStatus  result  =  _stateObj . Parser . TryRun ( RunBehavior . UntilDone ,  this ,  null ,  null ,  _stateObj ,  out  dataReady ) ; 
3686+                     if  ( result  !=  TdsOperationStatus . Done ) 
3687+                     { 
3688+                         throw  SQL . SynchronousCallMayNotPend ( ) ; 
3689+                     } 
36883690                } 
36893691            } 
36903692            catch  ( Exception  e ) 
@@ -4589,7 +4591,7 @@ private void ReadDescribeEncryptionParameterResults(SqlDataReader ds, ReadOnlyDi
45894591                            SqlParameter  sqlParameter  =  rpc . userParams [ index ] ; 
45904592                            Debug . Assert ( sqlParameter  !=  null ,  "sqlParameter should not be null." ) ; 
45914593
4592-                             if  ( SqlParameter . ParameterNamesEqual ( sqlParameter . ParameterName , parameterName , StringComparison . Ordinal ) ) 
4594+                             if  ( SqlParameter . ParameterNamesEqual ( sqlParameter . ParameterName ,   parameterName ,   StringComparison . Ordinal ) ) 
45934595                            { 
45944596                                Debug . Assert ( sqlParameter . CipherMetadata  ==  null ,  "param.CipherMetadata should be null." ) ; 
45954597                                sqlParameter . HasReceivedMetadata  =  true ; 
@@ -4920,7 +4922,7 @@ private void GenerateEnclavePackage()
49204922                return ; 
49214923            } 
49224924
4923-             if  ( string . IsNullOrWhiteSpace ( this . _activeConnection . EnclaveAttestationUrl )  &&   
4925+             if  ( string . IsNullOrWhiteSpace ( this . _activeConnection . EnclaveAttestationUrl )  && 
49244926                Connection . AttestationProtocol  !=  SqlConnectionAttestationProtocol . None ) 
49254927            { 
49264928                throw  SQL . NoAttestationUrlSpecifiedForEnclaveBasedQueryGeneratingEnclavePackage ( this . _activeConnection . Parser . EnclaveType ) ; 
@@ -5136,9 +5138,11 @@ private SqlDataReader RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavi
51365138                        Task  executeTask  =  _stateObj . Parser . TdsExecuteSQLBatch ( optionSettings ,  timeout ,  this . Notification ,  _stateObj ,  sync :  true ) ; 
51375139                        Debug . Assert ( executeTask  ==  null ,  "Shouldn't get a task when doing sync writes" ) ; 
51385140                        Debug . Assert ( _stateObj . _syncOverAsync ,  "Should not attempt pends in a synchronous call" ) ; 
5139-                         bool  result  =  _stateObj . Parser . TryRun ( RunBehavior . UntilDone ,  this ,  null ,  null ,  _stateObj ,  out  bool  dataReady ) ; 
5140-                         if  ( ! result ) 
5141-                         {  throw  SQL . SynchronousCallMayNotPend ( ) ;  } 
5141+                         TdsOperationStatus  result  =  _stateObj . Parser . TryRun ( RunBehavior . UntilDone ,  this ,  null ,  null ,  _stateObj ,  out  bool  dataReady ) ; 
5142+                         if  ( result  !=  TdsOperationStatus . Done ) 
5143+                         { 
5144+                             throw  SQL . SynchronousCallMayNotPend ( ) ; 
5145+                         } 
51425146                        // and turn OFF when the ds exhausts the stream on Close() 
51435147                        optionSettings  =  GetResetOptionsString ( cmdBehavior ) ; 
51445148                    } 
@@ -5296,9 +5300,11 @@ private void FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, stri
52965300                { 
52975301                    bool  dataReady ; 
52985302                    Debug . Assert ( _stateObj . _syncOverAsync ,  "Should not attempt pends in a synchronous call" ) ; 
5299-                     bool  result  =  _stateObj . Parser . TryRun ( RunBehavior . UntilDone ,  this ,  ds ,  null ,  _stateObj ,  out  dataReady ) ; 
5300-                     if  ( ! result ) 
5301-                     {  throw  SQL . SynchronousCallMayNotPend ( ) ;  } 
5303+                     TdsOperationStatus  result  =  _stateObj . Parser . TryRun ( RunBehavior . UntilDone ,  this ,  ds ,  null ,  _stateObj ,  out  dataReady ) ; 
5304+                     if  ( result  !=  TdsOperationStatus . Done ) 
5305+                     { 
5306+                         throw  SQL . SynchronousCallMayNotPend ( ) ; 
5307+                     } 
53025308                } 
53035309                catch  ( Exception  e ) 
53045310                { 
@@ -5869,9 +5875,9 @@ private SqlParameter GetParameterForOutputValueExtraction(SqlParameterCollection
58695875                    thisParam  =  parameters [ i ] ; 
58705876                    // searching for Output or InputOutput or ReturnValue with matching name 
58715877                    if  ( 
5872-                         thisParam . Direction  !=  ParameterDirection . Input  &&   
5873-                         thisParam . Direction  !=  ParameterDirection . ReturnValue  &&   
5874-                         SqlParameter . ParameterNamesEqual ( paramName ,  thisParam . ParameterName , StringComparison . Ordinal ) 
5878+                         thisParam . Direction  !=  ParameterDirection . Input  && 
5879+                         thisParam . Direction  !=  ParameterDirection . ReturnValue  && 
5880+                         SqlParameter . ParameterNamesEqual ( paramName ,  thisParam . ParameterName ,   StringComparison . Ordinal ) 
58755881                    ) 
58765882                    { 
58775883                        foundParam  =  true ; 
0 commit comments