Microsoft.Data.SQLite: Reader is not correctly closed when an exception occurs on DbCommand.ExecuteScalar() with 3.0.0-preview8 #17521
Labels
area-adonet-sqlite
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Milestone
When using
Microsoft.Data.SQLite
version3.0.0-preview8.19405.11
, when executing a command withExecuteNonQuery
,ExecuteScalar
orExecuteReader
causes an exception, we cannot change theCommandText
on theDbCommand
any more.Steps to reproduce
<PackageReference Include="Microsoft.Data.SQLite" Version="3.0.0-preview8.19405.11" />
Program.cs
:Expected behavior: Runs without exception.
Actual behavior:
Exception message:
System.InvalidOperationException: 'An open reader is associated with this command. Close it before changing the CommandText property.'
Stack trace:
This problem doesn't occur when using version
2.2.6
ofMicrosoft.Data.SQLite
.Workaround: Close the
DbCommand
and create a new one for executing the next command.Further technical details
EF Core version: 3.0.0-preview8.19405.11
Database Provider: Microsoft.Data.SQLite
Operating system: Windows 10 Version 1903 x64
IDE: Visual Studio 2019 16.2.3
Thanks!
The text was updated successfully, but these errors were encountered: