System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 15d3749655e12f15944e95ef6a026f3613fcdb8a
Title: BusyTimeout property is not used
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Connection Resolution: Fixed
Last Modified: 2021-05-02 18:20:46
Version Found In: 1.0.108.0
User Comments:
anonymous added on 2020-06-22 21:06:50:
Executing the following code (using Dapper) results in a connection with the BusyTimeout still being the default of 0:

using (var connection = new SQLiteConnection("pathToMyDb...")
		        {
			        connection.BusyTimeout = 5000;
			        connection.Open();
			        var result = connection.QueryFirstOrDefault("PRAGMA busy_timeout;");
		        }

I would expect the parameter to actually be used when opening the connection, based on its comment:

///Gets/sets the default busy timeout to use with the SQLite core library.  This is only used when
///opening a connection.

Looking at the source code for the Connection class, it is the Open() method which is resetting the BusyTimeout to 0. In the Open() method, it appears that the property's backing variable is set to an expected connection string parameter. If the connection string doesn't have the parameter for BusyTimeout it is reset to 0. Then, it checks to see if the parameter is not zero when determining whether or not to execute the PRAGMA for setting the BusyTimeout. Any value set via the property is overwritten.

mistachkin added on 2020-09-24 22:51:42:
Setting the BusyTimeout property this way is not currently supported.

Instead, please use the "BusyTimeout" connection string property within
your connection strings.

mistachkin added on 2020-09-25 20:52:13:
Thanks for the report.  As it turns out, the public property values were not
being preserved during Open when they should have been.  This has been fixed
on trunk via check-in [ba6105f57d2be787].