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 / CLR / October 2004

Tip: Looking for answers? Try searching our database.

AppDomain Unload

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken K - 14 Oct 2004 16:55 GMT
Hello,
Is there a way that an AppDomain can be forced to be unloaded?
AppDomain.Unload often throws an exception because a thread internal
to the CLR/ Framework is still running and can't be stopped. Is there
a way to force unloading of the AppDomain or kill this thread before
attempting an unload?

Thanks,
Ken
David Levine - 15 Oct 2004 03:32 GMT
The only threads that ought to cause this sort of problem are threads that
are executing in unmanaged code (e.g. via interop) - all managed threads
should be able to be unwound to the boundary of the appdomain so it can
unload. I don't know of any mechanism you can use to force a thread
executing in unmaged code to abort.

> Hello,
> Is there a way that an AppDomain can be forced to be unloaded?
[quoted text clipped - 5 lines]
> Thanks,
> Ken
Ken K - 15 Oct 2004 07:45 GMT
I logged all the thread ID's and the thread that seems to not get
unwound is actually just a managed thread on whicha client is calling
a method on a CAO. My application has a bunch of remotable objects
that various clients are connected to and making call while I am
trying to Unload the AppDomain containing these remotable objects. I
am expecting that at this stage all my clients will get forcibly
disconnected and get exceptions. However the domain sometimes does not
get unloaded in this case.

Ken.
Ken K - 15 Oct 2004 08:49 GMT
It seems that these threads that refuse to exist are created by .net
remoting using the ThreadPool class that seems to use the OS provided
Thread Pool internally. I suppose this would make these Unmanaged
threads.
However in any case I do want to Unload this Application Domain. Is
there a way to wait for these threads to exit? Or ask the Thread Pool
to kill its threads?

Ken.
David Levine - 15 Oct 2004 09:28 GMT
I don't believe there's any mechanism to force that behavior in the current
runtime.  You could try spawning a new process and  then kill the entire
process.

> It seems that these threads that refuse to exist are created by .net
> remoting using the ThreadPool class that seems to use the OS provided
[quoted text clipped - 5 lines]
>
> Ken.

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.