Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadow copy - Multiple resolves of same unmanaged DLL #146

Closed
KatoStoelen opened this issue Jul 15, 2020 · 0 comments 路 Fixed by #147
Closed

Shadow copy - Multiple resolves of same unmanaged DLL #146

KatoStoelen opened this issue Jul 15, 2020 · 0 comments 路 Fixed by #147
Labels
bug Something isn't working
Milestone

Comments

@KatoStoelen
Copy link
Contributor

KatoStoelen commented Jul 15, 2020

Describe the bug

Found a bug in my own contribution to this project 馃槃 It seems that there are scenarios where the same unmanaged DLL is resolved multiple times, which is not handled very well in the current shadow copy implementation.

System.IO.IOException: The file 'path\to\temp\random_dir_name\some_unmanaged.dll' already exists.

The fix is quite easy: Just return the path to the already existing DLL in the shadow copy directory.

I did, however, stumple upon a different issue when trying to reproduce this issue using Microsoft.Data.Sqlite (hot-reload sample), which I'll create a separate issue for.

To Reproduce
Steps to reproduce the behavior:

  1. Using version 1.3.0 of this library
  2. Enable hot reload
  3. Create a plugin (TargetFramework netcoreapp3.1) with a package reference to System.Data.SQLite (v1.0.113.1)
  4. Create an SQLiteConnection: new SQLiteConnection("DataSource=SomeFile.sqlite")
  5. See error: System.IO.IOException: The file 'path\to\temp\random_dir_name\SQLite.Interop.dll' already exists.

Expected behavior
No exceptions thrown.

@KatoStoelen KatoStoelen added the bug Something isn't working label Jul 15, 2020
KatoStoelen added a commit to KatoStoelen/DotNetCorePlugins that referenced this issue Jul 15, 2020
In some scenarios the same unmanaged DLL is resolved multiple times
(e.g. when using System.Data.SQLite.SQLiteConnection). The previous
implementation would then try to create new shadow copies of the same
DLL during subsequent resolves. This failed during copy of the DLL since
the parameter to enable overwriting was not set to true.

This fix checks if the shadow copy already exists and skips the copy
step if it does. The path to the existing shadow copy is returned
instead.

Fixes natemcmaster#146
natemcmaster pushed a commit that referenced this issue Aug 28, 2020
In some scenarios the same unmanaged DLL is resolved multiple times
(e.g. when using System.Data.SQLite.SQLiteConnection). The previous
implementation would then try to create new shadow copies of the same
DLL during subsequent resolves. This failed during copy of the DLL since
the parameter to enable overwriting was not set to true.

This fix checks if the shadow copy already exists and skips the copy
step if it does. The path to the existing shadow copy is returned
instead.

Fixes #146
@natemcmaster natemcmaster added this to the 1.3.1 milestone Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants