Skip to content

Commit a0dcffd

Browse files
Dispose with ConfigureAwait(false) in the procedure-name queries; pin Pkcs in the benchmarks (#108)
* The stored-procedure name queries in both SQL Server packages dispose their command and reader with ConfigureAwait(false), like every other await in the library. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * The benchmarks project pins System.Security.Cryptography.Pkcs 10.0.14, so Microsoft.Data.SqlClient no longer brings in the vulnerable 9.0.18. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent a18bab6 commit a0dcffd

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎Benchmarks/Open.Database.Extensions.Benchmarks/Open.Database.Extensions.Benchmarks.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<PackageReference Include="ZLinq" Version="1.6.1" />
2121
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.14" />
2222
<PackageReference Include="Microsoft.Data.SqlClient" Version="7.1.1" />
23+
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.14" />
2324
</ItemGroup>
2425

2526
<ItemGroup>

‎Source/MSSqlClient/ExpressiveSqlCommand.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ protected override async ValueTask<ImmutableArray<string>> GetProcedureParameter
194194
try
195195
{
196196
#if NET10_0_OR_GREATER
197-
await using SqlCommand command = ProcedureNamesCommand(connection, procedure);
198-
await using SqlDataReader reader = await command.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false);
197+
SqlCommand command = ProcedureNamesCommand(connection, procedure);
198+
await using var commandDisposal = command.ConfigureAwait(false);
199+
SqlDataReader reader = await command.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false);
200+
await using var readerDisposal = reader.ConfigureAwait(false);
199201
#else
200202
using SqlCommand command = ProcedureNamesCommand(connection, procedure);
201203
using SqlDataReader reader = await command.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false);

‎Source/SqlClient/ExpressiveSqlCommand.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ protected override async ValueTask<ImmutableArray<string>> GetProcedureParameter
197197
using SqlCommand command = ProcedureNamesCommand(connection, procedure);
198198
using SqlDataReader reader = await command.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false);
199199
#else
200-
await using SqlCommand command = ProcedureNamesCommand(connection, procedure);
201-
await using SqlDataReader reader = await command.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false);
200+
SqlCommand command = ProcedureNamesCommand(connection, procedure);
201+
await using var commandDisposal = command.ConfigureAwait(false);
202+
SqlDataReader reader = await command.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false);
203+
await using var readerDisposal = reader.ConfigureAwait(false);
202204
#endif
203205
return await ReadNamesAsync(reader, cancellationToken).ConfigureAwait(false);
204206
}

0 commit comments

Comments
 (0)