Index: System.Data.SQLite/SQLite3.cs ================================================================== --- System.Data.SQLite/SQLite3.cs +++ System.Data.SQLite/SQLite3.cs @@ -281,10 +281,11 @@ } // Bind functions to this connection. If any previous functions of the same name // were already bound, then the new bindings replace the old. _functionsArray = SQLiteFunction.BindFunctions(this, connectionFlags); SetTimeout(0); + GC.KeepAlive(_sql); } internal override void ClearPool() { SQLiteConnectionPool.ClearPool(_fileName); Index: System.Data.SQLite/SQLite3_UTF16.cs ================================================================== --- System.Data.SQLite/SQLite3_UTF16.cs +++ System.Data.SQLite/SQLite3_UTF16.cs @@ -125,11 +125,12 @@ _sql = new SQLiteConnectionHandle(db); lock (_sql) { /* HACK: Force the SyncBlock to be "created" now. */ } } _functionsArray = SQLiteFunction.BindFunctions(this, connectionFlags); - SetTimeout(0); + SetTimeout(0); + GC.KeepAlive(_sql); } internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt) { switch (_datetimeFormat)