all groups > dotnet clr > july 2004 >
You're in the

dotnet clr

group:

shared Domain and Assembly loading


Re: shared Domain and Assembly loading David Levine
7/30/2004 4:53:44 AM
dotnet clr:
What do you mean by a shared domain and shared assemblies? Do you mean
domain neutral assembies?

These two links talk about domain neutral assemblies.
http://blogs.msdn.com/cbrumme/archive/2003/06/01/51466.aspx
http://weblogs.asp.net/junfeng/

If all you mean is that you want to load the same assembly into different
appdomains, then that is straightforward. Each appdomain treats the assembly
as if it had never seen it before, so each can use its own binding policies,
security settings, etc. The assembly is not shared by the .net runtime. The
runtime does not copy the bits unless you have shadow copying enabled for
that appdomain.

To communicate between appdomains you must use some sort of inter-process
communications, such as remoting.

You must be careful to maintain the isolation between appdomains. Do not
return references to assemblies or types defined in assemblies unless you
understand the consequences. For example, returning a reference to an
assembly in a cross-appdomain method call causes the same assembly to get
loaded into both appdomains; if it cannot load the assembly then the runtime
throws an exception.

You don't apply security to the assembly itself, but you can supply
additional evidence when you load the assembly to set the top of stack
security. Be advised that this evidence does not get used if the loaded
assembly itself references and loads other assemblies (in v1.1). When a
method call crosses assembly boundaries the runtime evaluates the permission
request using the evidence associated with the assembly. If the appdomain
sets its own security policy it does not need to do anything different when
it loads the assembly - the policy in one appdomain does not affect the
policy in a different appdomain.

[quoted text, click to view]

shared Domain and Assembly loading Clément_ESCOFFIER
7/30/2004 10:23:52 AM
Hello,

I have a little questions about Assemblies who are loaded in the shared
Domain.

When an AppDomain ( perhaps the Default Domain create for the executable
) want use a Shared Assembly ( who is in the shard domain ), how the
assembly resolver find it ?

And when appdomain find the assembly, the runtime copy the assembly in
the appdomain or use it directly ?

All transaction between the shared domain and a appdomain use .Net
Remoting or its direct ?

A last question :
When an assembly is shared, and an appdomain load this assembly with a
different security policy. Can the appdomain use this assembly or it
must reload the assembly ( directly from the .dll or from the shared
domain ? )

thank you very much

Re: shared Domain and Assembly loading Junfeng Zhang[MSFT]
7/30/2004 10:04:58 PM
My blog does not talk about domain neutral assemblies. Chris's blog answered
most of Clement's questions.

For domain neutral assemblies case, conceptually there is a shared domain,
and all the domain neutral assemblies live in that shared domain.

The assembly lives both in the original appdomain and the shared domain so
CLR loader will find it automatically.

For your last question, if the security policy of the two appdomains are
different, then CLR Loader has to load a second copy of this assembly, from
the dll.

--
Junfeng Zhang
http://blogs.msdn.com/junfeng

[quoted text, click to view]

Re: shared Domain and Assembly loading ESCOFFIER_Clément
8/2/2004 4:39:52 PM
My goal is to evaluate the possibility to build dynamic application (
dynamic code loading and unloading ) on .Net.

The final goal of this project is to create a SOA ( Service Oriented
Architecture ) a little like OSGi with Java.

My idea with the neutral appdomain is not a good idea, we can't unload
this domain ( and we must can unload a service / code ).

Thank you for your answer

AddThis Social Bookmark Button