Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Practice How to isolate dynamic code / assemblies with .net CORE

With .NET 4.5 I created an extensible web application. With executes at run-time certified code from third parties.

For this, I use app domains and inter-process communication.

Now I saw that a lot of technologies I used for this aren't any more supported in .NET core

like:

  • AppDomains
  • Remoting
  • BinarySerzializers

For most of them, there are obvious solutions. But the remove of AppDomains is a tough thing.

If I understand it right I should use processes. But if my application has about 100 Extensions (multiple customers)? This would mean I would have to create 100 processes (microservices) or at least group some together in microservices.

But I don't feel very comfortable with either one. In the one way, I would end up with hundreds of processes. And if I group I could still get influences between them.

So what would be the right way to choose?

like image 234
Boas Enkler Avatar asked Jun 27 '16 07:06

Boas Enkler


1 Answers

One possible solution may be to use AssemblyLoadContext in place of AppDomains.

This isn't a direct replacement for AppDomains and the level of isolation that gives you, but it may be good enough for your needs - it allows you to use the equivalent of AppDomain.LoadFile and AppDomain.ResolveEvent to give you assembly loading isolation.

There is not any real documentation around this at the moment, but there is an issue for doing just that here: https://github.com/dotnet/coreclr/issues/5463

like image 50
Sock Avatar answered Sep 28 '22 09:09

Sock