BUG: A different method is invoked or an "Assertion failed" error message occurs when you try to invoke a method of a managed object from a COM client (828982)



The information in this article 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 "Assertion failed" 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 "Assertion failed" error message that is mentioned in the "Symptoms" 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 "Applies to" section of this article.

Modification Type:MajorLast Reviewed:3/15/2004
Keywords:kbBug kbManaged kbCOMServices kbCOMInterop kbinterop kberrmsg KB828982 kbAudDeveloper