Tracing QueryInterface calls on .NET implemented COM objects?

Hi,

Is there a any way to trace IUnknown::QueryInterface calls to a .NET implemented COM object? I have read several articles on this subject, and can't find any useful information.

I found the notion of Customer Debug Probes herehttp://blogs.msdn.com/adam_nathan/archive/2003/05/13/56680.aspx, but there is no update for the Framework 2.0, and it does not seem to work. It does not seem to be officially documented.

Is CDP still supported? Is there any other way?

Thanks.

[662 byte] By [SimonMourier] at [2008-1-10]
# 1
Try this Google query.
nobugz at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 2

hmm... thanks nobugz, but this is not relevant to what I need, unless I am wrong

First, activeX/COM inspector is a tool and I am looking for programmatic support, and then, although this tool allows me to inspect an existing COM object (even .NET ones, and even its Events), it does not allow to trace lowlevel QueryInterface calls on it.

SimonMourier at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 3

Hi Simon,

For a .net implemented COM object, it’s IUnknown interface is exposed by the COM Collable Wrapper(CCW) which is a proxy class and expose the QueryInterface function called by the COM aware client. The CCW is actually dynamically created by the CLR.

As far as I know, you cannot trace the CCW’s QueryInterface function in .net because the implementation of CCW is internal information and the CLR does not expose any interface of the class.

Maybe you can tell us what exactly you want or the problem block you in your application.

For more details, please visit: Shedding more light on the COM Interop wizardry.

Hope this helps!

Thanks!

FengChen-MSFT at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 4

Hi,

I know how the COM interop works. What I am looking for is exactly the "Customer Debug Probes" feature described here http://blogs.msdn.com/adam_nathan/archive/2003/05/13/56680.aspx

It does not seem to work anymore, but I may be doing something wrong. I can't find any information on it. Is it still there? Can it be enabled? how? is there another technique that replaces it? etc...

Thanks.

SimonMourier at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 5

Hi Simon,

The Customer Debug Probes (CDP) enable you to find and diagnose difficult bugs lurking in managed code, even in a production environment. But the QueryInterface function is called by the unmanaged code of CLR itself. So you cannot use it on this issue.

Thanks!

FengChen-MSFT at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 6

Hi,

Well, QueryInterface is originally called by the COM client, whoever that may be, not by the CLR execution engine that just transfers or transforms this call into a managed call. This COM client can be any COM code, written in any language.

One of the 11 Customer Debug Probes is specifically designed for tracing QI Calls. See here http://blogs.msdn.com/adam_nathan/archive/2003/09/12/56753.aspx

My original question is still valid. Is CDP still available? working? documented? Or... Why is Adam Nathan not working on these subjects anymore ?

Thanks

SimonMourier at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 7

Hi Simon,

The .NET Framework 2.0 provides Managed Debug Assistants (MDA) for finding problems at run time in the code you've written. Think of MDAs as CDP’s mature older sibling. For more details, please visit: High Availability: Keep Your Code Running with the Reliability Features of the .NET Framework.

Thanks!

FengChen-MSFT at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 8
They are now called Managed Debugging Assistants and integrated into the IDE debugger. Debug + Exceptions, MDAs, click the Thrown checkbox for FailedQI. Is that actually what you're looking for?
nobugz at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 9

It sure sounds good!

Thanks

SimonMourier at 2007-10-3 > top of Msdn Tech,.NET Development,Common Language Runtime...

.NET Development

Site Classified