mikeoliphant / AudioPlugSharp

Easily create VST (VST3) audio plugins in C# .NET
MIT License
177 stars 21 forks source link

AssemblyResolver shouldn't be static. #2

Closed Federerer closed 2 years ago

Federerer commented 3 years ago

Currently AssemblyResolver class and specifically static AssemblyLoadContext^ loadContext = nullptr; are static, which causes problems when I'm trying to load more than one plugin that are using AudioPlugSharp and are in different folders, because the second one tries to resolve assemblies from the first's location.

mikeoliphant commented 3 years ago

Yeah, I changed this locally a while back, but never committed it because I think it causes other potential problems.

If I recall correctly, I think I made it static because I was having trouble with WPF (specifically XAML) and multiple instances of the same plugin. There is an open dotnet issue that I believe is related:

https://github.com/dotnet/wpf/issues/1700

I have stopped using WPF for plugin UIs for this reason, among others...

mikeoliphant commented 2 years ago

I have now committed the change to make the load context not be shared across plugin instances.