I am not quite sure if I am experiencing a bug or I don't get how it supposed to work. So recently I've been trying to resolve this exception MySql.Data.MySqlClient.MySqlException: 'There is already an open DataReader associated with this Connection which must be closed first.'
and I started a debugging session to see what is going on. What I saw doesn't quite compute in my head (see the attached screenshot).
After I call reader.Close()
, the property IsClosed
stays false, and repeated calls to .Close()
(in the immediate windows) do not change that.
Is this expected behavior and my issue is somewhere else, or is this a bug and the cause of the exception?
This happens when using MySql.Data
v6.10.3-rc (from nuget.org), which is the only one supporting .NET Standard as of now. Also, the code is compiled to a .NET Core 2.0 app.
UPD: There are tasks around, but the reader is only worked with from the main thread. Also, reader
is declared as DbDataReader
, from which MySqlDataReader
is inherited.
UPD2: Apparently, if I call ((MySql.Data.MySqlClient.MySqlDataReader)reader).Close()
, then the reader closes properly. Looks to me like a bug in the connector and how they use virtual methods. Right?