By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,877 Members | 1,064 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,877 IT Pros & Developers. It's quick & easy.

Appdomain loading question

P: n/a
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\appdomainte stassembly.dll',
Symbols loaded.
'AppDomainTest.exe': Loaded 'c:\visual studio
projects\appdomain\appdomain\bin\debug\appdomainte stassembly.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

Dec 7 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Andrew Ducker" wrote:
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\appdomainte stassembly.dll',
Symbols loaded.
'AppDomainTest.exe': Loaded 'c:\visual studio
projects\appdomain\appdomain\bin\debug\appdomainte stassembly.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

Dec 7 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.