Hi Dean,

If you can use .Net 3.5 (which is in beta 2), you might consider taking a
look at System.AddIn.  It will allow you to create a pipeline to instantiate
your jobs (as add-ins) in separate AppDomains. The cool part of MAF is it
takes care of the cross app domain communication for you.  You'll still have
to write a fair bit of code but it should take care of your "best practices"
concerns.

Here are a couple of links to get you started.

http://msdn.microsoft.com/msdnmag/issues/07/02/CLRInsideOut/
http://blogs.msdn.com/tq/archive/2005/09/15/467714.aspx

A more thorough Google search should provide more details.

HTH,

Michael


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Dean Cleaver
Sent: Wednesday, September 12, 2007 1:38 PM
To: [email protected]
Subject: [ADVANCED-DOTNET] Correct handling of AppDomains

Hi,

I'm writing an automation module that is designed to fire various jobs
(created as assemblies implementing a given interface). I'm using
AppDomains to create an instance of the job (via the interface so I
don't load the assemblies into my original AppDomain).

The issue I have is that the jobs are asynchronous however I'm having a
hard time detecting when they're finished. If I try to add any events,
then the new AppDomain wants to load my service assembly.

If the AppDomain goes out of scope, I presume the code in it will still
execute? And will it ever unload? I've searched the net for best
practises on AppDomains, but can find very little on this type of issue
- most is the basics of how to create one, perform an action and then
unload it. Some of my jobs are only a few seconds long, others several
hours, so I don't really want to run them synchronously.

Cheers,
Dino

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to