Bug #84352 Entity Framework Core - ExecuteSqlCommandAsync() hangs
Submitted: 28 Dec 2016 1:58 Modified: 16 Jan 2017 20:34
Reporter: Paito Anderson Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:7.0.6-IR31 OS:Any
Assigned to: Gabriela Martinez Sanchez CPU Architecture:Any
Tags: .Net Core, entity framework, Entity Framework Core

[28 Dec 2016 1:58] Paito Anderson
Description:
Hi, When using the async version of ExecuteSqlCommand(), called ExecuteSqlCommandAsync() the thread hangs and never returns to the application. The data does get inserted to the database however.

Example:

Works fine:
Database.ExecuteSqlCommand("INSERT INTO TestTable (`DateTime`) VALUES (@utcDateTime);", parameters: new MySqlParameter("utcDateTime", MySqlDbType.DateTime) { Value = DateTime.UtcNow });

Thread Hangs:
await Database.ExecuteSqlCommandAsync("INSERT INTO TestTable (`DateTime`) VALUES (@utcDateTime);", parameters: new MySqlParameter("utcDateTime", MySqlDbType.DateTime) { Value = DateTime.UtcNow });

Attached is a test console application that demonstrates the issue.

MySQL Version used: 5.7.17

How to repeat:
Try a INSERT statement using ExecuteSqlCommandAsync().
[28 Dec 2016 1:58] Paito Anderson
Sample App

Attachment: ConsoleApp1.zip (application/x-zip-compressed, text), 1.93 KiB.

[13 Jan 2017 22:53] Gabriela Martinez Sanchez
I just try it using 6.10.0-alpha and EFCore 1.1. and works fine.
Could you try using this other version?
Please let us know if this worked.
Thanks in advance.
[14 Jan 2017 14:56] Paito Anderson
Hi Gabriela,

You are correct 6.10.0-alpha works, but 7.0.6-IR31 does not work.

Is 6.10.0-alpha actually the version people should be using with EF Core?

Paito
[16 Jan 2017 17:38] Gabriela Martinez Sanchez
For EF Core 1.1 yes, 6.10.x would be the one recommended. Eventually 7.0.x will be updated to have the latest support in EF Core but 6.10.x is a bit ahead.
Can we close this bug then ?
[16 Jan 2017 20:34] Paito Anderson
Closed, thanks for your help.