No AppDomains in .NET Core! Why?

Aditya Pasumarthi picture Aditya Pasumarthi · Dec 3, 2014 · Viewed 28.3k times · Source

Is there a strong reason why Microsoft chose not to support AppDomains in .NET Core?

AppDomains are particularly useful when building long running server apps, where we may want to update the assemblies loaded by the server is a graceful manner, without shutting down the server.

Without AppDomains, how are we going to replace our assemblies in a long running server process?

AppDomains also provide us a way to isolate different parts of server code. Like, a custom websocket server can have socket code in primary appdomain, while our services run in secondary appdomain.

Without AppDomains, the above scenario is not possible.

I can see an argument that may talk about using VMs concept of Cloud for handling assembly changes and not having to incur the overhead of AppDomains. But is this what Microsoft thinks or says? or they have a specific reason and alternatives for the above scenarios?

Answer

Hans Passant picture Hans Passant · Dec 3, 2014

The point of the .NETCore subset was to keep a .NET install small. And easy to port. Which is why you can, say, run a Silverlight app on both Windows and OSX and not wait very long when you visit the web page. Downloading and installing the complete runtime and framework takes a handful of seconds, give or take.

Keeping it small inevitably requires features to be cut. Remoting was very high on that list, it is quite expensive. Otherwise well hidden, but you can for example see that delegates no longer have a functional BeginInvoke() method. Which put AppDomain on the cut list as well, you can't run code in an app domain without remoting support. So this is entirely by design.