I need to use cross-appdomain calls in my app, and sometimes I have this RemotingException:
Object '/2fa53226_da41_42ba_b185_ec7d9c454712/ygiw+xfegmkhdinj7g2kpkhc_7.rem' has been disconnected or does not exist at the server.
The target object is still alive, I have checked it.
UPD I've set breakpoint in the finalizer of the target object, and it never hits. Thus, this object is alive and wasn't GC'ed.
That is probably because the local garbage collector at the server side collects the object. You can prevent that by renewing the leasing. You can read more about that in these articles:
Update: Unfortunately, the MSDN Magazine issues from 2008 or older are no longer browseable online, but only as .chm files that you have to download to your local machine. The previous issues can be found in:
This is because the Lifetime management on the server side disconnects the object when its lease expires, to allow GC to collect it. If you try to use it from the client side, you will get an Exception, even if it has not been GC'd on the server yet (e.g. because there still is another reference to it) but the lease has expired. This is to avoid unpredictable behaviour. The accepted answer provides a good reference on how to correctly manage the lifetime of Remote .NET Objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With