mono / mono-addins

Mono.Addins is a generic framework for creating extensible applications, and for creating add-ins which extend those applications.
MIT License
163 stars 95 forks source link

File is being used by another process when Updating an extension using Mono.Addins.Setup #17

Open fahadash opened 10 years ago

fahadash commented 10 years ago

I have an addin which is being updated at run time. I am using Mono.Addins.Setup.

The SetupService class has either Install() method or Uninstall(), but not Update()

I looked through the TextEditor sample and found that it is using Install() as an alternative to update.

I tried using that. I have an addin with single dll and addin.info xml file in single zip archive.

The name of dll file never changes with new releases. When I call Install() in order to update the addin, I get "Cannot access file.dll. Another process is using this"

If you need more info, please let me know I can provide that.

Am I using the wrong method to update the addin ? Should the new version of addin have different dll file name ?

christianhuening commented 10 years ago

I am experiencing the same issue. However I do not use Mono.Addins.Setup but instead just copy the files to a directory and then call AddingManager.Registry.Update(). Since this only happens on startup of my application, the addins are not actually instanciated at that time. Since I am doing that incrementally there still are some files of an older version left in the directory, which I need to overwrite and/or delete. That overwriting / deleting sometimes (race condition?!) fails with an IOException stating "Cannot access file.dll. Another process is using this".

First I thought it might be the AddinManager.Initialize() call which happens before the copy task. So I waited until AddinManager.IsInitialized became true. Sadly that didn't fix the problem.

The funny part is: If the race condition does not hit, everything works as it should. The addin gets updated, and I can work with it further on in the code.

I am using Mono.Addins on windows with .NET 4.5 btw. It's a bit strange, but on Mac Os X with latest Mono (3.10) the error never occurred so far.

Are there any suggestions what I could be doing wrong?