-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
Milestone
Description
Description
Today, System.Data.Odbc doesn't override async methods like DbCommand.ExecuteNonQueryAsync(...), and as a result all execution is synchronous.
This is of interest because ODBC can be used to query Apache Impala and Apache Hive from .NET using the ADO.NET framework.
Reproduction Steps
using OdbcConnection conn = new("..."); // connect to SQL server
conn.Open();
using var cmd = conn.CreateCommand();
cmd.CommandText = "WAITFOR DELAY '00:00:10';"
using CancellationTokenSource cts = new();
var executeTask = cmd.ExecuteNonQueryAsync(cts.Token); // runs synchronously for 10s
cts.Cancel();
await executTask; // not canceled
Expected behavior
It would be nice if this used async IO under the hood. [https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/asynchronous-execution-notification-method?view=sql-server-ver16](these docs) seem to suggest it is possible, but I'm not an Odbc expert...
Actual behavior
Falls back to sync implementation.
Regression?
No
Known Workarounds
You can force async execution using Task.Run, but this blocks a thread.
Configuration
Windows + .NET 6
Other information
No response