@@ -531,15 +531,11 @@ private void PrepareDescribeParameterEncryptionRequest(
531531 "_activeConnection should not be null at this time, in PrepareDescribeParameterEncryptionRequest." ) ;
532532
533533 // @TODO: Shouldn't there be a way to do all this straight from the connection itself?
534- TdsParser tdsParser = null ;
535- if ( _activeConnection . Parser is not null )
534+ TdsParser tdsParser = _activeConnection . Parser ;
535+ if ( tdsParser is null || tdsParser . State is TdsParserState . Broken or TdsParserState . Closed )
536536 {
537- tdsParser = _activeConnection . Parser ;
538- if ( tdsParser ? . State is TdsParserState . Broken or TdsParserState . Closed )
539- {
540- // Connection's parser is null as well, therefore we must be closed
541- throw ADP . ClosedConnectionError ( ) ;
542- }
537+ // Connection's parser is null as well, therefore we must be closed
538+ throw ADP . ClosedConnectionError ( ) ;
543539 }
544540
545541 parameterList = BuildParamList ( tdsParser , tempCollection , includeReturnValue : true ) ;
@@ -590,9 +586,9 @@ private void PrepareForTransparentEncryption(
590586 || ( _columnEncryptionSetting == SqlCommandColumnEncryptionSetting . UseConnectionSetting && _activeConnection . IsColumnEncryptionSettingEnabled ) ,
591587 "ColumnEncryption setting should be enabled for input parameter encryption." ) ;
592588 Debug . Assert ( isAsync == ( completion != null ) ,
593- "completion should can be null if and only if mode is async." ) ;
589+ "completion should be null if and only if mode is async." ) ;
594590
595- // Fetch reader witn input params
591+ // Fetch reader with input params
596592 Task fetchInputParameterEncryptionInfoTask = null ;
597593 bool describeParameterEncryptionNeeded = false ;
598594 SqlDataReader describeParameterEncryptionDataReader = null ;
@@ -1078,7 +1074,7 @@ private int ReadDescribeEncryptionParameterResults2(
10781074 // @TODO: Invert if statement based on answer to above TODO
10791075 if ( SqlParameter . ParameterNamesEqual ( sqlParameter . ParameterName , parameterName ) )
10801076 {
1081- Debug . Assert ( sqlParameter . CipherMetadata is not null , "param.CipherMetaData should not be null." ) ;
1077+ Debug . Assert ( sqlParameter . CipherMetadata is null , "param.CipherMetadata should be null." ) ;
10821078
10831079 sqlParameter . HasReceivedMetadata = true ;
10841080 receivedMetadataCount ++ ;
0 commit comments