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.