title: RunningObjectTable and weak registration
body: <p>I am trying to achieve the following functionality and I feel like I am really close but not quite there yet. I am posting this question to see if anyone may have already done something similar of has some insights into how this can best be achieved.</p>
  
  <p>In one application (call it the MainApp) I am creating COM objects that I need to get access to from another application (call it the Tool). To achieve that, I need to register the objects in the MainApp to a ROT. For reasons outside the scope of this question I am using a custom IRunningObjectTable implementation that runs as a service; also, the COM objects need to register themselves into the ROT upon creation and de-register themselves when they are no longer needed. This means that the ROT must only hold weak references to the COM objects and must not prolong their lifetime.</p>
  
  <p>Also, the ROT may be shut down while the COM objects still live. This must not lead to leaks or crashes in the MainApp. </p>
  
  <p>The Tool will interrogate the ROT and get interfaces to the registered objects. It will extract information from the objects and hold them alive while doing so, but release them as soon as it is done with them.</p>
  
  <p>The main problems I am facing are related to implementing the weak table registration and having the COM objects register and revoke themselves as opposed to being registered or revoked by their creator.</p>
  
  <p>Thanks for any tips.</p>