Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2007

Tip: Looking for answers? Try searching our database.

AppDomain and Multi-Threading

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kai Iske - 28 Nov 2007 19:58 GMT
Hi,

following situation (this is still .NET 1.1 - *sigh*)

For a scheduling application, I create a Thread for every task that is
due to be executed. Once a task execution is due, a running Thread
will be created. The runner thread in turn will instantiate a
TaskRunner object in a new AppDomain, so it is like that. The
TaskRunner then instantiates the Task class and calls a method on an
interface:

1. Create New Thread
2. Thread creates new AppDomain
3. TaskRunner is created in new AppDomain
4. TaskRunner instantiates task class and executes interface method

2. - 4. all happen on the same (newly created thread)

After the TaskRunner has executed the task method, it cleans up,
however when the Thread calls to unload the AppDomain it previously
created, the whole thread is aborted and no code is executed anymore
after the unload.

I don't quite understand why this would happen. My worker thread runs
on the main AppDomain and creates/unloads a child AppDomain. I wonder
why unloading that child AppDomain would kill my worker thread.

Any help would be highly appreciated.

Thanks

Kai
Ross Presser - 04 Dec 2007 20:20 GMT
> Hi,
>
[quoted text clipped - 24 lines]
>
> Any help would be highly appreciated.

Is an exception thrown when you unload? I'd start there, put a try/
catch around the unload in the thread.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.