Microsoft KB Archive/828982

= BUG: A different method is invoked or an &quot;Assertion failed&quot; error message occurs when you try to invoke a method of a managed object from a COM client =

Article ID: 828982

Article Last Modified on 4/19/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.1
 * Microsoft .NET Framework 1.0

-





SYMPTOMS
When you try to invoke a method of a managed object that exists in a non-default application domain from a Component Object Model (COM) client, one of the following symptoms may occur:
 * A different method is invoked.
 * You receive an &quot;Assertion failed&quot; error message.

Note This error message specifies that the assertion failed because of a calling convention mismatch.



CAUSE
Because the managed object exists in a non-default application domain, the common language runtime must pass the COM Callable Wrapper (CCW) for the managed object between the default application domain and the non-default application domain. However, when the common language runtime passes the CCW between the application domains, the transparent proxy for the managed object receives an incorrect virtual function table (vtable). Therefore, when you try to invoke a method of the managed object from the COM client, the transparent proxy tries to invoke a different method. If the signature of the method that the transparent proxy tries to invoke is not significantly different from the signature of the method that you tried to invoke, a different method is invoked. If these two signatures are significantly different, you receive the &quot;Assertion failed&quot; error message that is mentioned in the &quot;Symptoms&quot; section of this article.



RESOLUTION
To resolve this problem, query for an appropriate interface in the COM client before you try to invoke a method of the managed object. To do this, cast the instance of the managed object to the appropriate interface in the COM client. The common language runtime queries for the interface when you try to invoke a method of the managed object. The transparent proxy for the managed object receives the correct virtual function table and then invokes the method that you tried to invoke.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section of this article.

