[Mono-osx] SqliteConnection inside NSAutoreleasePool

Duane Wandless duane at wandless.net
Thu Jul 7 08:36:13 EDT 2011

I am using sqlite, background threads, and NSAutoreleasePool without
problems.  I use Mono.Data.SqliteClient.

using (NSAutoReleasePool...)
   using (SQLiteConnection...)
      using (SQLiteCommand...)

I open and close the connection for each command.  I do not try to keep the
db open across threads, or for very long.  Mainly because of
even though you should be able to.  I also set the BusyTimeout for the
connection and the ComandTimeout for the command to 30 seconds.  This way
when the DB is locked for updates the waiting commands do not error out.

It might also be useful to post the errors you are getting.

Best of luck,


On Thu, Jul 7, 2011 at 4:40 AM, Juan Roman Escamilla <
juanroman at unosquare.com> wrote:

>  After *too much* debugging I have realized that SqliteConnection throws
> all sort of errors when running within a background thread contained inside
> an NSAutoreleasePool. At the end it´s always a Null Pointer Exception. I
> have checked my code and the issue is not within it.
>  The funny thing is that if I run it with the debugger attached it works
> like a charm. It is only when running outside of the debugger that it fails.
>  What is the correct way to spawn a background thread that will leverage
> Sqlite?
>  Thanks in advance,
>  Juan Roman
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20110707/a2087e2b/attachment.html 

More information about the Mono-osx mailing list