c# - DLL hell with SQLite -


some of our users getting issue version of sqlite.interop.dll being loaded @ runtime, , it's real head scratcher.

background: wpf application built anycpu, deployed sqlite .net , sqlite.interop.dll version 1.0.89. deploy both x86 , x64 dlls , employ delay loading included sqlite. has been fine until recently, when started getting few support issues users had - typically - purchased new dell machines. seems there older version of sqlite.interop.dll (v.1.0.80) that, somehow, getting loaded in preference 1 ship. error missing entry point, 'sqlite3_changes_interop'.

what have tried:

  1. changing setup copy appropriate dll (x86/64) same directory executable during installtion (i.e. no separate x86/x64 folders). means no longer use delay loading, correct dll available in executable directory (although haven't explicitly disabled delay loading mechanism in sqlite.net). doesn't fix problem..

  2. explicitly loading sqlite.interop.dll when application first loads. again, not seem fix issue.

it seems ordering of dll loading locations has been changing in recent years, , may not have handle on it. assumed dll in executable directory first preference, , dll had been explicitly loaded prevent same dll being reloaded during application lifetime, life of cannot understand going on here.

can shed light on might happening here? problem further compounded fact cannot reproduce problem locally - e.g. putting wrong version of dll in system path etc. makes me think maybe gac might coming play?

really stuck on one, great.

also - final resort - might consider reverting same 1.0.80 version, don't issue. know source older versions of sqlite.net , sqlite.interop.dll?

edit - additional information:

the clash caused copy of sqlite.interop.dll version 1.0.80 installed dell backup , recovery. installed on new dell machines, , users install our software on such machine experience issue. dell software uses system.data.sqlite.dll.

the correct version of sqlite.interop.dll located in same directory our executable, , understand dll loading suggests should loaded in preference.

although have not yet been able reproduce issue locally, appears bad version of interop.dll not on path. furthermore, dell backup utility runs automatically on start-up. know of possible mechanism might hooking dll load requests , serving wrong file?

the current line of thinking might build our own system.data.sqlite.dll , change interop loading code named version (e.g. sqlite.interop.1.0.89.dll). not nice solution going forwards, but..

our app has same problem. mentioned, problem dell backup , recovery installs shell extension uses old versions of several popular dlls. play hell app launches file dialogs , uses libraries, because shell extensions load dlls appdomain. solution have far tell users uninstall dell backup , recovery.

if force app load correct library dymanoid mentioned, app crash when displays file dialog (because shell extension crash). if don't that, app crash when tries read database.

interestingly, dell backup , recovery repeat offender; breaks qt5 in same way. recommended solution qt guys compile qt library under different name -qtnamespace [name] option. might able rig system.data.sqlite, we'd have compile our own version.

microsoft aware of problem, has declined fix it.

i wish dell guys had implemented shell extension like this.

portroit pro, sonar, , autodesk's solution problem uninstall dell backup , recovery.

a typical stack trace of problem looks in our application:

system.accessviolationexception: attempted read or write protected memory. indication other memory corrupt.  @ system.data.sqlite.unsafenativemethods.sqlite3_open_interop(byte[] utf8filename, int32 flags, intptr& db)  @ system.data.sqlite.sqlite3.open(string strfilename, sqliteconnectionflags connectionflags, sqliteopenflagsenum openflags, int32 maxpoolsize, boolean usepool)  @ system.data.sqlite.sqliteconnection.open()  @ stcommonshellintegration.datashellmanagement.createnewconnection(sqliteconnection& newconnection)  @ stcommonshellintegration.datashellmanagement.initconfiguration(dictionary`2 targetsettings)  @ dbroverlayicon.dbrbackupoverlayicon.initcomponent() 

so in answer track's comment, if want detect particular problem , give users special notice, this:

appdomain.currentdomain.unhandledexception += uehandler; //... static void uehandler(object sender, unhandledexceptioneventargs e){   var ex = e.exceptionobject exception;   if( ex.tostring().contains( "dbroverlayicon" ){     //show dialog here telling users uninstall dbar   } } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -