Skip to content

Commit 4ce9c83

Browse files
authored
Merge | Port #528 and #2091 to netfx (#3376)
* Port #528 and #2091 to netfx * Following review - redundant null check
1 parent 1eabf80 commit 4ce9c83

File tree

3 files changed

+261
-59
lines changed

3 files changed

+261
-59
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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;
@@ -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

Comments
 (0)