title: Proper way of releasing COM objects?
body: <p>Sometimes when I end the application and it tries to release some COM objects, I receive a warning in the debugger:</p>
  
  <blockquote>
    <p><code>RaceOnRCWCleanUp</code> was detected</p>
  </blockquote>
  
  <p>If I write a class which uses COM objects, do I need to implement <code>IDisposable</code> and call <code>Marshal.FinalReleaseComObject</code> on them in <code>IDisposable.Dispose</code> to properly release them?</p>
  
  <p>If <code>Dispose</code> is not called manually then, do I still need to release them in the finalizer or will the GC release them automatically? Now I <a href="https://stackoverflow.com/a/628814/1386111">call <code>Dispose(false)</code> in the finalizer</a> but I wonder if this is correct.</p>
  
  <p>The COM object I use also have an event handler which the class listens to. Apparently the event is raised on another thread, so how do I correctly handle it if it is fired when disposing the class?</p>