title: Marshal.ReleaseComObject throws exception
body: <p>Trying to use a COM visible .NET class via other .NET application and get exception:</p>
  
  <blockquote>
    <p>Message: The object's type must be
    __ComObject or derived from __ComObject.</p>
    
    <p>Parameter name: o</p>
    
    <p>Stack Trace:    at
    System.Runtime.InteropServices.Marshal.ReleaseComObject(Object
    o)</p>
  </blockquote>
  
  <p>The class looks as follows:</p>
  
  <pre><code>[ComVisible(true)]
  [InterfaceType(ComInterfaceType.InterfaceIsDual)]
  public interface IViewer : IComInteropDefinedInterface
  {
  }
  
  [ClassInterface(ClassInterfaceType.None)]
  [ComVisible(true)]
  [Guid("[some guid]")]
  public class MyViewer : UserControl, IViewer    
  {
      //IViewer implementation
  }
  </code></pre>
  
  <p>I register the component with:</p>
  
  <pre><code>regasm [Assembly Path] /tlb /codebase
  </code></pre>
  
  <p>The client application, which is also in .NET instantiates successfully the given class, but when he calls<code>Marshal.ReleaseComObject()</code> it gets the exception described above.</p>
  
  <p>Any idea for solving this problem?</p>
  
  <p><strong>EDIT:</strong>
  Unfortunately I can't provide the client application code for instantiating my object. However I know the client is using the same method to instantiate real COM objects.</p>