I'm using SQLite as a means of moving data between a UI and a service but I've run into a few problems. I've looked around and I can't see anyone else with an issue like this. I've triple checked all my references, the x64 folder containing the Interop dll is included in the project, all these dlls are set to copy to the output directory, all directories have the right permissions and nothing's worked.
This is part of a larger problem I'm experiencing where if I use an SQLite Connection in my BackgroundWorker Completed function then the entire service crashes out with File not found exception, if I run an SQLite Connection inside the actual BackgroundWorker I get the Unable to load DLL 'SQLite.Interop.dll' error and finally if I use an SQLite Connection in a function that has no relation to a BackgroundWorker then it works perfectly (referencing this function from either BackgroundWorker event functions results in the same errors respectively).
Any help on this would be great
Code
Dim LiteUpdateString As String = ""
Dim LiteConnection = New SQLiteConnection("Data Source=C:\...\AppData\Roaming\OPCService\Tags.db;Version=3;FailIfMissing=True")
Dim LiteUpdate As String = ""
UpdateNumber += 1
teststring += UpdateNumber.ToString
LiteUpdate = $"UPDATE SQLiteTags SET TagQuality='{teststring}' {SQLWhere}"
Dim Command As New SQLiteCommand(LiteUpdate, LiteConnection)
LiteConnection.Open()
Command.ExecuteReader()
LiteConnection.Close()
Errors
BackgroundWorkerCompleted
Application: OPCService.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException at OPCService.OPCService.BackgroundWorker1_RunWorkerCompleted(System.Object, System.ComponentModel.RunWorkerCompletedEventArgs) at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(System.ComponentModel.RunWorkerCompletedEventArgs) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch()
BackgroundWorker
Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)