From: Tony Johansson on
Hi!

Assume that have an assembly called myAssembly.exe and this must be running
in two instances then I have two alternatives.
1. Let this myAssembly.exe be running in two threads in one application
domain.
2. Let this myAssembly.exe be running in two appliaction domain using a one
thread in each.

So my question is that I will almost find it much better to use one
application domain for each assembly because
of isolation between application domain.

So when is there an advantage to use only one application domain running
several *.exe assemblies ?

//Tony


From: Arne Vajhøj on
On 17-05-2010 09:28, Tony Johansson wrote:
> Assume that have an assembly called myAssembly.exe and this must be running
> in two instances then I have two alternatives.
> 1. Let this myAssembly.exe be running in two threads in one application
> domain.
> 2. Let this myAssembly.exe be running in two appliaction domain using a one
> thread in each.
>
> So my question is that I will almost find it much better to use one
> application domain for each assembly because
> of isolation between application domain.
>
> So when is there an advantage to use only one application domain running
> several *.exe assemblies ?

There are a performance penalty of using multiple app domains
because all calls between app domains get serialized.

There is a functional difference because static fields
will exist in multiple instances - one in each app domain.

You should only use multiple app domains if you really need
to isolate some code.

My guess is that 80% of .NET developers have never had a reason
to create a new app domain (not counting .NET frameworks that
create app domains for them).

Arne