I'm migrating an app from .NET Framework to .NET 5.0.
In my previous implementation, I was dynamically reading assemblies from an external source, then loading them into different AppDomains, then running an Action through a CrossAppDomainDelegate
.
Code sample which would run for each assembly:
var setup = new AppDomainSetup
{
ApplicationBase = AppDomain.CurrentDomain.BaseDirectory,
};
var domain = AppDomain.CreateDomain($"MyDomain", null, setup);
var del = new CrossAppDomainDelegate(action); // The action I'm running
domain.DoCallBack(del);
In .NET 5.0, I can still create the domain (even though I can't use the Setup as before) but I can't seem to find a way to run the action through a delegate, since CrossAppDomainDelegate
is no longer supported.
Any ideas on how to achieve this? Is it even possible? If not, what's another way to achieve this functionality?