Question

In .Net remoting, if one creates a list of remote objects, then if the remote side goes away and you try to access one of the list items you would get an exception.

All well and good, you can try catch it, not the end of the world.

However, if you try to remove a disconnected MarshalByRefObject from a List<MarshalByRefObject> you get another exception because List.Remove() uses Object.Equals() and it becomes impossible to clean the list.

Should this be resolved with some sort of local wrapper for the MarshalByRefObject object or is there a cleaner approach out there?

Was it helpful?

Solution

The solution we implemented was indeed wrap/compose the MarshalByRefObject in a local so that the list could get cleaned out correctly. Proxy Design Pattern is the cleanest way!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top