Bug 13263 - sqlite db file was left open after executing update statement against sqlite database in xamarin
Summary: sqlite db file was left open after executing update statement against sqlite ...
Status: NEW
Alias: None
Product: Tools
Classification: Mono
Component: other ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2013-07-15 22:00 UTC by Andrew Duan
Modified: 2013-07-16 00:51 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 13263 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Andrew Duan 2013-07-15 22:00:55 UTC
Hi All,

In xamarin.mac, I used Enterprise library to access sqlite database. When I use instruments to spy on file activity,
and realised that db file was left open when I execute the following.

var sql1 = new StringBuilder();
      sql1.AppendLine(string.Format("UPDATE {0}", "Tradesperson_Team"));
      sql1.AppendLine("  SET");
      sql1.AppendLine(string.Format("    Local_alteration_date_time={0}", db.CurrentDateTimeFunction));
      sql1.AppendLine(string.Format("    ,Local_altered_by='{0}'", User.Identity.Name));
      sql1.AppendLine(string.Format("    ,Record_status='{0}'", RecordStatus.Synchronising));
      sql1.AppendLine("  WHERE");
      sql1.AppendLine(string.Format("    Record_status IN ('{0}', '{1}')", 

      var documents = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
      string dbfile = Path.Combine(documents, "pocketBEIMS.db3");
      var connection = new SqliteConnection("Data Source=" + dbfile);

      using (var cmd = connection.CreateCommand ())
        cmd.CommandText = sql1.ToString();

I also tried to explicitly call connection.Dispose(), but no good. I doubt that,
too many open files error might appear if I execute something like above many times.

Appreciate any helps,

Comment 1 Andrew Duan 2013-07-16 00:51:18 UTC
The sample code is not using enterprise library, it uses sqliteConnection. but both of them have the same problem.