AppDomain / Object Lifetime & AppDomain.Unload

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If anyone could land me a hand here, would be much appreciated.

Application is using Interface based plugin system.

Load Steps:
Initialize loader class -> Create App Domain -> Load Assembly -> Get an
instance of a class and return well-defined interface back to the caller

When underlying assembly is changed, the change is detected new app domain
is created and requests for new objects will be executed on the new domain.
The part that I'm uncertain about:
What happens with objects already created? Obviously the reference to a
proxy object still exists, is application domain going to exist until the
time all references to it are gone or proxy objects will end up pointing into
the void?

Also, what happens in the same scenario but when AppDomain.Unload is called?

All processing is being done on the same system.

thanks, in advance.
 
Based on a few experiments -
When a function on a proxy pointing to an unloaded domain is executed,
application "quits" (interesting how IDE trapped no exceptions)

When a function on a proxy pointing to a loaded but abandoned domain is
executed
(i.e. AppDomain object which is not referenced from anywhere other then a
proxy object & real object residing within) everything continues to function.

These experements brought up another question - if setting an infinite lease
time on a remote object will prevent GC from collecting it, then how is it
possible to trigger destruction of an infinite lease object? Does anyone know
an answer?
 
Back
Top