title: When to correctly release Outlook COM-objects?
body: <p>I know similar questions have been asked here, but I feel like I don't understand it correctly.</p>
  
  <p>I have the following code for example:</p>
  
  <pre><code>Microsoft.Office.Interop.Outlook.Explorer expl = myOutlooApplication.ActiveExplorer();
  if (expl.Selection.Count &gt; 0)
  {
      object selObject = expl.Selection[1];
      if (selObject is Microsoft.Office.Interop.Outlook.MailItem)
      {
          mailItem = (selObject as Microsoft.Office.Interop.Outlook.MailItem);
          this.myUserControl.MailItem = mailItem;
      }
  }
  </code></pre>
  
  <p>As you can see, the MailItem gets passed to a property of myUserControl. MyUserControl will need to access this property later to extract some information from the MailItem.</p>
  
  <p>Should I <code>Marshal.ReleaseComObject()</code> after passing the MailItem to myUserControl to reduce the reference counter of the RCW or is this too early?</p>
  
  <p>EDIT:
  My problem is, that a .msg file will be opened from the file system. After closing the inspector, the user tries to open the file again, but it is locked and I am sure that the COM objects not being released properly is the cause for that.</p>