You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This line: MyContext.Database.SqlQuery<MyTableDO>("select * from my_table where id = 1").First(); throws an exception "Invalid attempt of read when the reader is closed". This is working in the provider for EF5 but not in version for EF6
The text was updated successfully, but these errors were encountered:
I can confirm the bug:
var result = (from x in Context.Table select x).ToList();
works correct, but
var result = Context.Table.SqlQuery("SELECT * FROM TABLE").ToList();
fails with error: "Invalid attempt of read when the reader is closed."
This worked before with EF5.
I played a bit with the sources. When using SqlQuery, the instance of FbCommand gets disposed before the containing FbDataReader is being accessed. That does not happen with a "normal" Linq-to-SQL query. After modifying the dispose method to not doing anything (just return), the query works correctly. Sure, this is not an acceptable solution, but it could help the experts to identify the underlying problem. I suppose it has something to do with the new async functionality of EF6.
After the using block, the FbCommand is disposed. Then the reader is accessed.
But in FbCommand, the reader is actively closed if the FbCommand gets disposed.
Submitted by: Sergio Cardenas (scardenas)
Votes: 2
This line: MyContext.Database.SqlQuery<MyTableDO>("select * from my_table where id = 1").First(); throws an exception "Invalid attempt of read when the reader is closed". This is working in the provider for EF5 but not in version for EF6
The text was updated successfully, but these errors were encountered: