DLL hell with SQLite

前端 未结 3 759
栀梦
栀梦 2021-02-18 14:15

Some of our users are getting an issue with the version of sqlite.interop.dll that is being loaded at runtime, and it\'s a real head scratcher.

Background: A WPF applica

3条回答
  •  一向
    一向 (楼主)
    2021-02-18 15:11

    SQLite.Interop.dll is loaded in a tricky way.
    By using any reflector you can inspect UnsafeNativeMethods.Initialize() method in System.Data.SQLite.dll by yourself.
    Some notes to demonstrate, that it is possible to get something interesting by reflection(1.0.89 version):

    • If SQLite.Interop.dll is placed in base directory - it will be loaded
    • PreLoadSQLite_BaseDirectory and PreLoadSQLite_UseAssemblyDirectory environment variables can affect loading process
    • SQLite.Interop.dll can be searched in predifined subfolders(x86, x64, Win32, Itanium, WinCE)
    • Trace.WriteLine is called to inform selected path(not always)

    Source code is also available.

提交回复
热议问题