Appdomain loading question

A

Andrew Ducker

I'm trying to load an assembly into a temporary AppDomain rather than
my main AppDomain, so that it can be unloaded later on. However, it's
also loading into my main AppDomain at the same time.

My code is:
AppDomain a = AppDomain.CreateDomain("TestDomain");
a.Load("AppDomainTestAssembly");

and in the Console window I get the following when the second line
executes:
'TestDomain': Loaded 'c:\visual studio
projects\appdomain\appdomain\bin\debug\appdomaintestassembly.dll',
Symbols loaded.
'AppDomainTest.exe': Loaded 'c:\visual studio
projects\appdomain\appdomain\bin\debug\appdomaintestassembly.dll',
Symbols loaded.

Which clearly means it's loading into both assemblies, yes? Is there a
reason why it's not just loading into TestDomain?

Cheers,

Andy D
 
G

Guest

To load an assembly into another AppDomain "cleanly" you must do so without
loading any Type data into the main AppDomain.

MVP Ambrose Little has a couple of articles he calls the "Perfect Service"
that explains a very neat way to do this in great detail:

http://www.15seconds.com/issue/040624.htm

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top