title: COM Interop throwing EEMessageException when invoking managed DLL
body: <p>What a nightmare COM interop is proving to me.  I have a simple managed DLL containing a WPF window. I have a simple ViewController class that will eventually be launching this window but for now has an empty method that does nothing.</p>
  
  <p>I have created a managed wrapper for this managed DLL, that exposes an interface registered for COM interop.  I can call into my managed wrapper OK.  I can display a MessageBox in the entry point of my managed wrapper DLL.  However, if I attempt to call ANY method on this ViewController class in the DLL I am wrapping, I get this: </p>
  
  <p>First-chance exception at 0x7c812aeb (kernel32.dll) in MfcVSApp1.exe: Microsoft C++ exception: EEMessageException at memory location 0x0012cb30..</p>
  
  <p>It all worked yesterday apparently.  Now some code:</p>
  
  <p>My wrapper entities:</p>
  
  <pre><code>[Guid("83C799E0-9808-40c2-A1AB-80BCB77A3B18")]
      [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
      [ComVisible(true)]
      public interface IMaryln
      {
          void GetEphemeris(DateTime date, double latitude, double longitude);
  
          /// &lt;summary&gt;
          /// 
          /// &lt;/summary&gt;
          /// &lt;param name="date"&gt;&lt;/param&gt;
          /// &lt;param name="latitude"&gt;&lt;/param&gt;
          /// &lt;param name="longitude"&gt;&lt;/param&gt;
          void GetEphemeris1(Int64 millSecsSince1970, double latitude, double longitude);
      }
  
   [Guid("144DB386-D8EF-41a8-B9B1-57EE8A64600C")]
      [ClassInterface(ClassInterfaceType.None)]
      [ProgId("ManagedProxy.Maryln")]
      [ComVisible(true)]
      public class Maryln : IMaryln
      {
          #region IMaryln Members
  
          public Maryln()
          {
              System.Diagnostics.Debugger.Launch();
          }
  
          public void GetEphemeris(DateTime date, double latitude, double longitude)
          {
              //new EphemerisViewController().GetEphemeris(date, latitude, longitude);
          }
  
          public void GetEphemeris1(Int64 nanoSecsSince1970, double latitude, double longitude)
          {
              // This method does not throw.  However, it will not be executed
              // if any method in EphemerisViewController is called.
              MessageBox.Show("Called from c++" + nanoSecsSince1970.ToString());
  
  
              try
              {
                  //new Maryln().Test();    // this will not throw
                  new EphemerisViewController().GetString();   // this will 
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message);
              }                              
          }
  
          public void Test()
          {
              MessageBox.Show("maryln test");
          }
  
          #endregion
      }
  </code></pre>
  
  <p>The Managed DLL, referenced by the managed wrapper DLL, contains a UserControl and this ViewController:</p>
  
  <pre><code>public class EphemerisViewController
      {      
          public EphemerisViewController()
          {          
          }                 
  
          public void GetString()
          {
              MessageBox.Show("me");
          }
  
      }
  </code></pre>
  
  <p>This DLL was also registered for COM interop but then I unchecked that option as it did not help matters.  Gurus on board, I need help here.  This has consumed two working days already and I have taken 3 steps back from where I started.  It all worked yesterday. </p>
  
  <p><strong>Addition</strong></p>
  
  <p>The native client is consuming my wrapper as follows:</p>
  
  <pre><code>void CMfcVSApp1Doc::LaunchEphemrisDialog()
  {   
      HRESULT hr;
      CoInitialize(NULL);
      try 
      {               
          ManagedProxy::IMarylnPtr maryln(__uuidof(ManagedProxy::Maryln));    
          LONG64 time = 1309897499216000000;
          hr = maryln-&gt;GetEphemeris1(time, 0, 0);
      }
      catch(...)
      {
  
      }
  }
  </code></pre>
  
  <p>Also, I have cleaned and rebuilt solution numerous times but no luck.</p>