-
-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hot Reloading and NativeLibrary.Load(String, Assembly, DllImportSearchPath?) #148
Comments
Well, what did work in this specific scenario was to explicitly load My first thought was that Anyways. It seems like this would be solvable with an API to "pre-load" specific unmanaged DLLs. |
Unmanaged DLLs that are loaded outide the assembly load context are not found when hot reloading (load in memory) is enabled. This happens when NativeLibrary.Load(String, Assembly, DllImportSearchPath?) is used. This change adds an API that lets consumers of this package configure a set of unmanaged libraries to preload before any other resolving happens. Fixes natemcmaster#148
The public API suggestion above was abandoned. Looking for solutions where the host does not have to care about the dependencies of plugins, instead.
On a positive note, seems like the behavior of |
Closing this. Not possible to fix for .NET Core. Also, this issue is a duplicate of #84 (sorry about that). |
Describe the bug
Not sure if this is a bug or something this library cannot support. I was trying to reproduce #146 using the hot-reload sample. There we use Microsoft.Data.Sqlite to test shadow copying and loading of sni.dll. When expandig the sample by creating an instance of
SqliteConnection
, there is a lot more happening under the hood. Particulary in SQLitePCL.raw which uses system.runtime.interopservices.nativelibrary.load to load native libraries. This API does not invokeAssemblyLoadContext.LoadUnmanagedDll
. Hence, this library does not control how those native libraries are loaded, and cannot perform any shadow copying etc. That is, if my understanding is correct.To Reproduce
Steps to reproduce the behavior:
using var dbConnection = new SqliteConnection("Data Source=db.sqlite");
to theInfoDisplayer
in the hot-reload sampleSystem.DllNotFoundException: Unable to load DLL 'e_sqlite3' or one of its dependencies: The specified module could not be found. (0x8007007E)
Expected behavior
Would be nice if there is a solution to this issue, but I can understand that there might not be.
Additional context
Full stack trace:
The text was updated successfully, but these errors were encountered: