|Title:||Not Compatible with MSTest (concurrent App Domains)|
|Last Modified:||2011-10-04 09:19:54|
|Version Found In:||18.104.22.168|
The new logging code in 22.214.171.124 seems to be causing (me) problems when using SQLite from within MSTest.
I think the problem is related to MSTest's usage of multiple App Domains (one per assembly containing unit tests).
SQLiteLog.Initialize is getting a SQLITE_MISUSE error when it tries to set the log callback function. From what I can tell looking at the SQLite source, the most likely cause of that is that the native library has been initialized (and not fully shutdown?)
anonymous added on 2011-10-04 04:20:23 UTC:
Not sure if this is fixable within the SQLite library.
A workaround would be to call new SQLiteConnection().Shutdown() in an AssemblyInitialize method, except that won't work because the SQLiteConnection constructor will fail in the SQLiteLog initialization before the Shutdown call can be made.
mistachkin added on 2011-10-04 04:42:03 UTC:
mistachkin added on 2011-10-04 08:10:08 UTC:
Basically, the "fix" for this is to prevent the SQLiteLog class from being initialized in non-default AppDomains unless the special environment variable "Force_SQLiteLog" is set to manually override this new behavior. This is not an ideal fix; however, it seems reasonable and it is the best that can done without having a reference counting mechanism in the SQLite core library itself.