Skip to content

Commit 776caec

Browse files
committed
Add ? to _activeConnection references in trace logging - fixes the broken unit test
1 parent c0ba212 commit 776caec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.Reader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public SqlDataReader EndExecuteReader(IAsyncResult asyncResult)
7070
"SqlCommand.EndExecuteReader | API | Correlation | " +
7171
$"Object Id {ObjectID}, " +
7272
$"Activity Id {ActivityCorrelator.Current}, " +
73-
$"Client Connection Id {_activeConnection.ClientConnectionId}, " +
73+
$"Client Connection Id {_activeConnection?.ClientConnectionId}, " +
7474
$"Command Text '{CommandText}'");
7575
}
7676
}
@@ -82,7 +82,7 @@ public SqlDataReader EndExecuteReader(IAsyncResult asyncResult)
8282
"SqlCommand.ExecuteReader | API | Correlation | " +
8383
$"Object Id {ObjectID}, " +
8484
$"Activity Id {ActivityCorrelator.Current}, " +
85-
$"Client Connection Id {_activeConnection.ClientConnectionId}, " +
85+
$"Client Connection Id {_activeConnection?.ClientConnectionId}, " +
8686
$"Command Text '{CommandText}'");
8787

8888
SqlStatistics statistics = null;
@@ -1018,7 +1018,7 @@ private Task<SqlDataReader> InternalExecuteReaderAsync(
10181018
#if NET
10191019
if (!_parentOperationStarted)
10201020
{
1021-
s_diagnosticListener.WriteCommandBefore(operationId, this, _transaction, e);
1021+
s_diagnosticListener.WriteCommandError(operationId, this, _transaction, e);
10221022
}
10231023
#endif
10241024

@@ -1459,7 +1459,7 @@ private SqlDataReader RunExecuteReaderTds(
14591459
"SqlCommand.RunExecuteReaderTds | Info | " +
14601460
$"Object Id {ObjectID}, " +
14611461
$"Activity Id {ActivityCorrelator.Current}, " +
1462-
$"Client Connection Id {_activeConnection.ClientConnectionId}, " +
1462+
$"Client Connection Id {_activeConnection?.ClientConnectionId}, " +
14631463
$"Command executed as RPC, " +
14641464
$"RPC Name '{rpc.rpcName}'");
14651465
}

0 commit comments

Comments
 (0)