title: Why use FinalReleaseComObject instead of ReleaseComObject?
body: <p>I know the basic difference as <code>ReleaseComObject</code> only decreases some counter by one and <code>FinalReleaseComObject</code> decreases it to zero. </p>
  
  <p>So what I usually hear is, call <code>FinalReleaseComObject</code> because then you are sure that the COM object is really released. </p>
  
  <p>But this makes me wonder, there is a point to this counter right? Aren't you breaking that mechanism if you always call <code>FinalReleaseComObject</code>. If that counter is not <em>one</em> before you call <code>ReleaseComObject</code>, is there not probably a reason for it?</p>
  
  <p>What could cause it to be higher than one when it should not be?</p>
  
  <p>Thanks in advance.</p>
  
  <p>PS: My COM experience only consists of using Excel Interop. Not sure if this question is local to that domain (i.e. outside Office Interop, <code>FinalReleaseComObject</code> is not often used).</p>
  
  <h2>Update 1</h2>
  
  <p>The <a href="http://blogs.msdn.com/vcblog/archive/2006/09/20/762884.aspx" rel="noreferrer">article</a> Dan mentioned talks about using <code>ReleaseComObject</code> when you're done. As I understand from the <a href="http://blogs.msdn.com/vcblog/archive/2006/09/20/762884.aspx" rel="noreferrer">article</a>, this is the normal way. I think that if you do this consistently it should work fine. In a comment to the <a href="http://blogs.msdn.com/vcblog/archive/2006/09/20/762884.aspx" rel="noreferrer">article</a> the author suggests someone to call <code>ReleaseComObject</code> in a loop until it is really released (the <a href="http://blogs.msdn.com/vcblog/archive/2006/09/20/762884.aspx" rel="noreferrer">article</a> is from 2006, so this is analogues to calling <code>FinalReleaseComObject</code>). But he also states that this could be dangerous. </p>
  
  <blockquote>
    <p>If you really want to the RCW to call Release() at a particular point in the code, you can call ReleaseComObject() in a loop until the return value reaches zero.  This should ensure the RCW will call Release().  However, if you do that, be warned, when the other managed references try to use that RCW, it will cause an exception."</p>
  </blockquote>
  
  <p>This leads me to believe that it is indeed <em>not</em> a good idea to always call <code>FinalReleaseComObject</code>, as you can cause exceptions elsewhere. As I see it now, you should only call this if you are absolutely sure that you can.</p>
  
  <p>Still, I have little experience in this matter. I don't know how I can be sure. If the counter is increased when it should not be, is it not better to fix that problem? If so, then I would say <code>FinalReleaseComObject</code> is more of a hack than a best practice.</p>