"Unable to set temporary directory" SQLException

Jul 28, 2014 at 9:23 AM
Hi,
Trying a demo app on Windows Phone Silverlight 8.1. When trying to open a new database, getting a SQLiteException: Unable to set temporary directory.

var conn = new SQLiteConnection("Mydatabase.db");

How can I resolve this?
Developer
Sep 5, 2014 at 5:24 PM
Hi @andywigley,

Could you provide us some detailed error information, like the complete stack trace on the exception.

Regards,
Oct 6, 2014 at 4:26 PM
Thanks for replying.

I just updated to package v3.8.5.1 (with SQLite 3.8.6) and I am no longer seeing this error :).
Marked as answer by marianosz on 11/26/2014 at 8:01 AM
Feb 28 at 6:53 PM
If anyone else is having problems with this exception, I urge you make sure sqlite3.dll is included with Copy-Always settings in every project where SQLitePCL is referenced.

I got this exception in a project using a PCL, which was referenced from a UWP app for Windows 10, and after debugging with symbols for SQLitePCL I found that an exception is originally thrown because sqlite3.dll could not be found. This exception is caught in the last catch statement (catch (Exception ex) {...) in the method SQLiteConnection.SetTemporaryDirectory(), and is then thrown as a problem specifically related to the temporary directory, and not a problem with the dll-imported functions. Why it's failing in SetTemporaryDirectory is just an unlucky chance, since it's really the first attempt being made at calling any dll-imported function.

If work on this library is still active I would recommend a sanity check first thing in the SQLiteConnection, making sure the dll-imported functions are actually valid, and returning a better exception otherwise.