using TrackingServices in remoting

TrackingServices is probably the most underrated feature of remoting. It can be put to various uses. Once you register your tracking handler, it will receive callbacks each time a MarshalByRefObject is Marshalled (explicitly using RemotingServices.Marshal or when a MBR type crosses a remoting boundary, either as a CAO or part of the serialized message). Similarly there are callbacks for Unmarshalled (when an ObjRef is converted into a proxy) and when a remote object is disconnected (either when its lease expires, or through RemotingServices.Disconnect). TrackingServices can be used as a logging or a debugging aid to diagnose lease expiry issues. One use of this feature is also to get a scenario to work where there are both local and remote clients, and you need to have the local clients keep working even if the network disconnects. You can use TrackingServices to filter the right ChannelData out to local clients.