NETCore-Snowflake-Framework icon indicating copy to clipboard operation
NETCore-Snowflake-Framework copied to clipboard

Use MySqlConnector for async I/O

Open bgrainger opened this issue 3 years ago • 3 comments

The Repository code uses ExecuteScalarAsync. It's a long-standing bug in MySql.Data (bug 70111) that async I/O is not implemented correctly; thus all these methods will actually run synchronously. (See also here and here on Stack Overflow.)

To fix this, you could switch to https://github.com/mysql-net/MySqlConnector, an OSS replacement for MySql.Data that supports true asynchronous I/O; it also has full .NET Standard/.NET Core support.

If you're interested in this, I'd be happy to open a PR.

bgrainger avatar Apr 24 '21 15:04 bgrainger

thanks! but we all use Mysql.Data for a long time, it looks alright, are you sure about this?

microfisher avatar Jun 16 '21 06:06 microfisher

I know for a fact that all the ExecuteNonQueryAsync, ExecuteReaderAsync etc. methods in MySql.Data don't actually execute asynchronously. (For example, see the bug report I linked above, and notice that there is no implementation of those methods in the repo: https://github.com/mysql/mysql-connector-net/search?q=ExecuteNonQueryAsync.)

If using actual async I/O is important to this project, then you'll need to change MySQL .NET libraries.

bgrainger avatar Jun 16 '21 14:06 bgrainger

thanks a lot! i'll fix it.

microfisher avatar Jun 17 '21 01:06 microfisher