-
Notifications
You must be signed in to change notification settings - Fork 351
Description
Since MySqlConnector provides true async methods, some users want to invoke multiple "overlapped" operations, e.g., executing multiple ExecuteNonQueryAsync method calls simultaneously, e.g., #554, #560, #562.
This gives an error (probably inspired by Connector/NET): "There is already an open DataReader associated with this Connection which must be closed first."
While true, this doesn't help the user understand the problem. It's also confusing if the user is just calling ExecuteScalar and doesn't understand that a DataReader is being used behind the scenes: https://stackoverflow.com/questions/51854390/without-any-select-there-is-already-an-open-datareader-associated-with-this
We should create a documentation page that explains the problem, the two common forms of misuse (overlapping on the same thread, e.g., calling ExecuteNonQuery from within a while (reader.Read()) loop; multiple simultaneous async calls on different threads), and how to resolve the error. Then the exception message should be simplified ("Cannot start a second operation while this connection is in use"?) and have a link to that page.