Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing the default app domain

Tags:

I am looking for a way to find the default app domain in my process. Note than the current app domain may be different from the default one, for example when my code is running inside NUnit.

I know that I can list all the app domains in the process using a COM interop trick shown in this answer, and pick the one for which IsDefaultAppDomain() is true. However, this seems like a heavyweight solution.

Is there a way to get the default appdomain that does not require filtering all the domains, preferably without going through COM interop?

like image 788
Sergey Kalinichenko Avatar asked Jun 11 '13 21:06

Sergey Kalinichenko


People also ask

What is the domain of an app?

An application domain is the segment of reality for which a software system is developed. It is the background or starting point for the actual-state analysis and the creation of a domain model. An application domain can be an organization, a department within an organization, or a single workplace.

What is application domain in C#?

Application domains provide an isolation boundary for security, reliability, and versioning, and for unloading assemblies. Application domains are typically created by runtime hosts, which are responsible for bootstrapping the common language runtime before an application is run.

How does an app domain get created?

AppDomains are created by the . Net runtime when a managed application is initialised. When you start ABC. EXE, it gets an application domain.

What is app pool and app domain?

Application Domain is an ASP.NET concept which provides isolation for each ASP.NET application. Application Pool is an IIS concept which also provides isolation but at the process level. Application Domain is available only for ASP.NET applications.


1 Answers

To my knowledge, the .NET framework does not support that. You would have to use the unmanaged solution which does support it.

like image 117
TheDaveJay Avatar answered Oct 15 '22 13:10

TheDaveJay