Is your feature request related to a problem? Please describe.
When developing plugins, DesktopMagic needs to be fully closed to overwrite a plugin. This results in a frustrating loop of Make Change -> Close DM -> Update plugin file -> Reopen DM -> Repeat
Currently DesktopMagic uses Assembly.LoadFrom to load plugin DLLs. This results in a file lock on the plugin's main.dll, which prevents hot updates.
Describe the solution you'd like
A possible solution seems to be shadow copying, which copies the target DLL to a temp directory and loads the copy, but still uses the original path for binding context. This would allow DesktopMagic to load plugin assemblies without locking the original file, allowing the plugin to be hot-updated by overwriting the file and hitting "Reload" in DM.
A caveat to this is that the article linked in the above SO thread only applies to .NET Framework, and I'm struggling to find resources on shadow copying in general assembly loading on .NET 8+
Describe alternatives you've considered
It seems shadow copying could be implemented manually, though that could have unforeseen issues and inflates the scope of the change. I've also seen mention of 3rd party frameworks/libraries that can accomplish generic dotnet assembly "plugin" loading with hot reload support, such as MEF (Managed Extensibility Framework).
MEF is specific to .NET Framework 4, but modern alternatives may be available.
Is your feature request related to a problem? Please describe.
When developing plugins, DesktopMagic needs to be fully closed to overwrite a plugin. This results in a frustrating loop of Make Change -> Close DM -> Update plugin file -> Reopen DM -> Repeat
Currently DesktopMagic uses
Assembly.LoadFromto load plugin DLLs. This results in a file lock on the plugin'smain.dll, which prevents hot updates.Describe the solution you'd like
A possible solution seems to be shadow copying, which copies the target DLL to a temp directory and loads the copy, but still uses the original path for binding context. This would allow DesktopMagic to load plugin assemblies without locking the original file, allowing the plugin to be hot-updated by overwriting the file and hitting "Reload" in DM.
A caveat to this is that the article linked in the above SO thread only applies to .NET Framework, and I'm struggling to find resources on shadow copying in general assembly loading on .NET 8+
Describe alternatives you've considered
It seems shadow copying could be implemented manually, though that could have unforeseen issues and inflates the scope of the change. I've also seen mention of 3rd party frameworks/libraries that can accomplish generic dotnet assembly "plugin" loading with hot reload support, such as MEF (Managed Extensibility Framework).
MEF is specific to .NET Framework 4, but modern alternatives may be available.