Unable to load DLL 'sqlite3.dll'


I am using the update released on November 25, 2014 and everything seemed to work fine till now and at once I am getting the following error

Note::The error listed below is in the demo examples that came with the SQLCipher package. The exception listed below happens on line 249 in SQLite.cs in the sqlcipher-windows-runtime-81-demo project. The code on that line is listed below:

SQLite3.SetDirectory(/temp directory type/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path)

The exception detail is listed below:

“An exception of type ‘System.DllNotFoundException’ occurred in sqlcipher-windows-runtime-81-demo.exe but was not handled in user code”

System.DllNotFoundException was unhandled by user code
Message=Unable to load DLL ‘sqlite3.dll’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at SQLite.SQLite3.SetDirectory(UInt32 directoryType, String directoryPath)
at SQLite.SQLiteConnection…ctor(String databasePath, SQLiteOpenFlags openFlags, Boolean storeDateTimeAsTicks)
at SQLite.SQLiteConnection…ctor(String databasePath, Byte key, SQLiteOpenFlags flags, Boolean storeDateTimeAsTicks)
at SQLite.SQLiteConnection…ctor(String databasePath, Byte key, Boolean storeDateTimeAsTicks)
at SQLite.SQLiteConnection…ctor(String databasePath, String key, Boolean storeDateTimeAsTicks)
at sqlcipher_windows_runtime_81_demo.MainPage…ctor()
at sqlcipher_windows_runtime_81_demo.sqlcipher_windows_runtime_81_demo_XamlTypeInfo.XamlTypeInfoProvider.Activate_0_MainPage()
at sqlcipher_windows_runtime_81_demo.sqlcipher_windows_runtime_81_demo_XamlTypeInfo.XamlUserType.ActivateInstance()

More information:

  • I am a domain user who has been added to the local Administrators group on the development machine.
  • I have Visual Studio opened as Administrator.
  • I have also tried to uninstall/re-install and restart the machine and this is not changed the situation.

Hello @rupendradhillon

Can you verify you have the latest SQLCipher for Windows Runtime Visual Studio extension installed on your machine? You can verify this within Visual Studio under the Tools → Extensions and Updates… menu. With the latest vsix package installed, I was able to successfully run the same demo.


As I mentioned earlier, I have the November 25th Update installed on my system. Below is the screenshot for that (http://i.imgur.com/Bb8v0cd.png?1).

In case the image does not open: The version is 3.2.0.

Again, The reason that it works on your machine and not mine is most probably because of environmental differences. However, since you own the code, could you let me know what is making it crash and we could investigate this further.

Rupendra Dhillon

Hello @rupendradhillon

Were you able to run the demo application successfully before at one point?

Yes, but I am not sure what has changed that it does not work anymore.Moreover, the fact that the dll file is sitting in the folder makes it hard to understand why it is not getting loaded.

Some more information

  • The package (Windows Store app) is being built for x86 and is running on a 64 bit tablet.

Hello @rupendradhillon

In the event that you made changes to the demo project, can you uninstall the Visual Studio extension, delete the existing demo project, then download the SQLCipher package again, unzipping it and installing the VSIX pacakge? Finally, run the new unaltered demo project on your machine? Please let us know your results. Thanks!

The issue was a permission denied on the VC Libs (x86) package that tried to load as part of the SQLite3.SetDirectory function call. After granting permissions things worked fine.

Hello @rupendradhillon

Thanks for getting back to us, we are glad to hear everything is working well for you now.