471,320 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,320 software developers and data experts.

Appdomain loading question

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
1 1630
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.

Similar topics

2 posts views Thread by Satinderpal Singh | last post: by
2 posts views Thread by Lauren Hines | last post: by
1 post views Thread by Cider123 | last post: by
6 posts views Thread by Wal Turner | last post: by
22 posts views Thread by JPSutor | last post: by
3 posts views Thread by Frank Uray | last post: by
4 posts views Thread by illegal.prime | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.