@@ -35,7 +35,7 @@ public sealed partial class SqlCommand : DbCommand, ICloneable
3535 {
3636 private static int _objectTypeCount ; // EventSource Counter
3737 private const int MaxRPCNameLength = 1046 ;
38- internal readonly int ObjectID = Interlocked . Increment ( ref _objectTypeCount ) ; private string _commandText ;
38+ internal readonly int ObjectID = Interlocked . Increment ( ref _objectTypeCount ) ;
3939
4040 internal sealed class ExecuteReaderAsyncCallContext : AAsyncCallContext < SqlCommand , SqlDataReader , CancellationTokenRegistration >
4141 {
@@ -113,6 +113,7 @@ protected override void AfterCleared(SqlCommand owner)
113113 }
114114 }
115115
116+ private string _commandText ;
116117 private CommandType _commandType ;
117118 private int ? _commandTimeout ;
118119 private UpdateRowSource _updatedRowSource = UpdateRowSource . Both ;
@@ -2645,7 +2646,7 @@ private Task<int> InternalExecuteNonQueryAsync(CancellationToken cancellationTok
26452646 {
26462647 s_diagnosticListener . WriteCommandError ( operationId , this , _transaction , e ) ;
26472648 source . SetException ( e ) ;
2648- context . Dispose ( ) ;
2649+ context ? . Dispose ( ) ;
26492650 }
26502651
26512652 return returnedTask ;
@@ -2794,7 +2795,7 @@ private Task<SqlDataReader> InternalExecuteReaderAsync(CommandBehavior behavior,
27942795 }
27952796
27962797 source . SetException ( e ) ;
2797- context . Dispose ( ) ;
2798+ context ? . Dispose ( ) ;
27982799 }
27992800
28002801 return returnedTask ;
@@ -3051,7 +3052,6 @@ private Task<XmlReader> InternalExecuteXmlReaderAsync(CancellationToken cancella
30513052 }
30523053 context . Set ( this , source , registration , operationId ) ;
30533054
3054-
30553055 Task < XmlReader > returnedTask = source . Task ;
30563056 try
30573057 {
0 commit comments