System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 1b0bb16a622b6fe359c55882b327779ece3855e1
Title: Improve UnsafeNativeMethods.GetBaseDirectory.
Status: Closed Type: Feature_Request
Severity: Minor Priority: Medium
Subsystem: Integration_Via_PInvoke Resolution: Fixed
Last Modified: 2013-03-07 21:13:46
Version Found In: 1.0.84
User Comments:
anonymous added on 2013-03-07 10:41:04: (text/x-fossil-plain)
Currently you use "AppDomain.CurrentDomain.BaseDirectory" to determine a base search path for the interop (x86/x64) assemblies, but it would be better if the base is determined by the location of the System.Data.Sqlite.dll itself. This could be done if you replace the existing code with "Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)".

This would allow the assemblies to be moved to a probing path without breaking anything.
E.g. if you use an App.config like:
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="PlugIns" />
      <publisherPolicy apply="yes" />
    </assemblyBinding>
  </runtime>

For now I use "Environment.SetEnvironmentVariable("PreLoadSQLite_BaseDirectory", Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));" as a workaround - but I wonder if this could be a better standard behavior.

Best regards,
Andreas

mistachkin added on 2013-03-07 21:13:23: (text/x-fossil-wiki)
<blockquote>
The improvements to the native library pre-loading feature that you are asking
for have already been implemented on trunk, several days ago, [80f0294664|here].

However, using this new feature does require setting the environment variable
"PreLoadSQLite_UseAssemblyDirectory" to something (like "1").

I'm not eager to change the default pre-loading behavior for fear of breaking
any apps that may rely on the current defaults.
</blockquote>