As of release 1.0.82.0, the object disposal semantics were changed to keep
the underlying connection around until all associated System.Data.SQLite
objects have been properly disposed.

Levi Haskell wrote:
> 
> var file = Path.GetTempFileName();
> using (var connection = new SQLiteConnection("Data Source=" + file))
> {
>   Console.WriteLine(connection.GetType().Assembly.FullName);
>   connection.Open();
> 
>   var command = connection.CreateCommand();
>   command.CommandText = "CREATE TABLE t(a)";
>   command.ExecuteNonQuery();
> }
> // the following line succeeds in v1.0.81.0 and earlier but
> // FAILS on v1.0.82.0 and later with "file still in use" error
> File.Delete(file);
> 

In the above example, adding "command.Dispose();" just prior to the end of
the using block should allow the file to be deleted.

>
> Was this change made by design?
>

Yes.

--
Joe Mistachkin

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to