all groups > dotnet clr > may 2005 >
You're in the

dotnet clr

group:

Loading assemblies from another AppDomain


Re: Loading assemblies from another AppDomain Phil Wilson
5/19/2005 4:59:35 PM
dotnet clr: See if the AppDomain.AssemblyResolve event is your friend.
--
Phil Wilson [MVP Windows Installer]
----
[quoted text, click to view]

Loading assemblies from another AppDomain Vagif Abilov
5/20/2005 12:27:13 AM
Hello,

My application creates an AppDomain and sets is base directory outside the
directory of the creator. Then it needs to load in a newly created domain an
assembly that is installed in the original (creator) domain. And fails, of
coures, because new domain does not have this directory in it's probing
path.

It looks like not much can be done about it, because probing path can only
be extended with sub-directories of the base directory, and the new domain
simply does not have access to assemblies available to a domain-creator,
unless they are installed in the GAC.

Right now to resolve this issue I temporary copy missing assemblies to a new
domain base directory, but such approach is quite ugly.

Am I overlooking something? Is this by design, and if I create a new domain
with its own base directory, it can't search for required assemblies in the
directory of the creating domain?

Thanks in advance

Vagif Abilov

Re: Loading assemblies from another AppDomain Vagif Abilov
5/20/2005 5:31:15 AM
Well, it basically falls to the same problem. I've added AssemblyResolve
event handler, but the implementation of this method lies in the creating
domain - newly created domain does not have any code in its BaseDirectory.
Looks like I have to dynamically generate and compile the handler code,
unless I'll find another way.

Vagif


[quoted text, click to view]

Re: Loading assemblies from another AppDomain Vagif Abilov
5/21/2005 12:00:00 AM
Unfortunately this won't help. Private bin path can't lie outside the
application base, i.e. it's just a hint to searh in other sub-directories.
It can't be set to any other directory on the machine.

Vagif


[quoted text, click to view]

RE: Loading assemblies from another AppDomain Günter Prossliner
5/21/2005 8:46:11 AM
Hi Vagif!

[quoted text, click to view]

Have you checked the PrivateBinPath / PrivateBinPathProbe Properties from
the AppDomainSetup class?

// Set up the AppDomainSetup
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = "(some directory)";
setup.PrivateBinPathProbe = "(probe directory)";

// Set up the Evidence
Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
Evidence evidence = new Evidence(baseEvidence);
evidence.AddAssembly("(some assembly)");
evidence.AddHost("(some host)");

// Create the AppDomain
AppDomain newDomain = AppDomain.CreateDomain("newDomain", evidence, setup);


OK?
AddThis Social Bookmark Button