DangerZone DangerZone - 11 months ago 67
C# Question

SQLite trying to load SQLite.Interop from strange location

The versions of System.Data.SQLite.dll and SQLite.Interop.dll in both my x86 and x64 folders are on (the reference is also this version, updated from an older version). However, I have the following error:

Unable to find an entry point named 'sqlite3_changes_interop' in DLL 'SQLite.Interop.dll'

Since they are all the same version, this post, and similar posts, havn't been able to help.

I've turned on native code debugging. The SQLite dll itself seems to have loaded from the correct place, as I see a message in the debug output similar to:

Loaded 'L:\path_to_project_folder\x64\System.Data.SQLite.dll'

And these other lines also exist in the output:

Loaded 'L:\path_to_project_folder\x64\SQLite.Interop.dll'

Loaded 'C:\Program Files (x86)\Dell Backup and Recovery\Components\Shell\SQLite.Interop.dll'

This seems strange to me... I do have a Dell Backup and Recovery utility, and there is an older version of the SQLite and Interop dlls in this path (both so it would seem like the SQLite in my project folder is trying to use this interop dll and I have absolutely no clue why.

Is there any particular reason this would happen? Is there a way to circumvent/eliminate this behavior?

Please do not suggest removing this utility as it is not an appropriate approach to ask all customers using the program to do the same.

Answer Source

Apparently the issue was with the Dell Backup and Recovery utility that was installed on my system. Upon reading about similar issues involving the same utility, it seems as though that utility was forcing that particular older version of SQLite to be used somehow.

Opening an in-memory connection as soon as my program started seemed to have fixed this issue. The correct version is now being loaded.

using (SQLiteConnection conn = new SQLiteConnection("Data Source=:memory:"))

It seems likely that I wasn't seeing this issue prior to updating SQLite because the reference I had and the version of the interop the Dell tool used were compatible.