Before I forget you might want to create and control a specific object in
the new AppDomain here is the method for that.
To create an instance of the object that will run in the AppDomain. This is
achieved by calling CreateInstance which has 3 overloads.
ObjectHandle hndPoolManager = aDomain.CreateI nstance("myTmpD om",
"myNameSpace.Po olManager");
Where the second param must be the fully-qualified namespace of the
object. Alternatively you can call typeOf(PoolMana ger).ToString() to get it.
If you require to interface with the object to call methods or pass data
back and forth you will need to create a proxy to communicate with the
object as it's not in your current domain. This uses Remoting to marshal the
data between the domains. Fortunately the .Net Framework provides a method
to dynamically create this for you.
(PoolManager)hn dPoolManager.Un wrap();
Alternativly you can accomplish these two methods by just doing the
following:
(PoolManager)aD omain.CreateIns tanceAndUnwrap( .., ..);
- Mike
---------------------------------------------------------------------------------
http://www.cogitar.net "> Cogitar Software. (
http://www.cogitar.net )
http://www.web-dominion.co.uk Web-Dominion. (Web Design and hosting )
http://www.shop-dominion.com (senery landscape picture gallery)
---------------------------------------------------------------------------------
<Mike> wrote in message news:Od******** ********@TK2MSF TNGP12.phx.gbl. ..
To resolve the unexpected exception killing the entire application you can
create a new app dominion and execute the threads in that. If you create a
thread manager in the new AppDominion that creates a limited number of
threads. Then to increase the number of threads (if required) create a new
app dominon. This means if a thread has to be killed it will only affect a
limited number of threads.
So how do you do this? First you need to create the temporary AppDomain
AddDomain aDomain = AppDomain.Creat eDomain("myTmpD om");
If you're going to create a number of these generate a unique name
for each one.
Second you need to load the Assembly (exe/dll) into the new AppDomain
ADomain.Load("F ileSystemWatche r.dll")
This will load an Assembly called FileSystemWatch er.dll (or whatever you
choose to call it), which would contain your thread pool manager and
threads. If something does go wrong you then only need to kill the
temporary domain leaving the other temp domains (if created) and your
primary Application running.
- Mike
---------------------------------------------------------------------------------
http://www.cogitar.net "> Cogitar Software. ( http://www.cogitar.net )
http://www.web-dominion.co.uk Web-Dominion. (Web Design and hosting )
http://www.shop-dominion.com (senery landscape picture gallery)
---------------------------------------------------------------------------------