Reputation: 3
If I start console, wpf or asp.net application, will .Net create any AppDomain? Could I assume that there is always exactly one AppDomain?
Upvotes: 0
Views: 199
Reputation: 156968
Yes, there is always one, unless you, or any third party library you use, creates new AppDomain
s.
According to MSDN an AppDomain
is an
isolated environment where applications execute
This might be useful when your software loads some untrusted assemblies as add-ins for example. You could create a secundary AppDomain
, load the untrusted assemblies in there, and execute their methods, without having the risk it tempers your original AppDomain
.
Upvotes: 0
Reputation: 941407
Yes for a console mode app and a WPF app. It is murkier for an ASP.NET app, it uses appdomains to isolate web sites. And a web site can migrate from one to another when it shadow-copies assemblies.
Upvotes: 1