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 "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.
REFERENCES
For more information, visit the following Microsoft Developer Network (MSDN) Web sites:
Exposing .NET Framework Components to COM
http://msdn2.microsoft.com/en-us/library/zsfww439(vs.71).aspx
COM Callable Wrapper
http://msdn2.microsoft.com/en-us/library/f07c8z1c(vs.71).aspx
Application domains
http://msdn2.microsoft.com/en-us/library/cxk374d9(vs.71).aspx
Additional query words: CLR, QI, AV, Assert, COM Interface, AppDomain
Keywords: kbbug kbmanaged kbcomservices kbcominterop kbinterop kberrmsg KB828982