How to debug unreleased COM references from managed code?

Posted by Marek on Stack Overflow See other posts from Stack Overflow or by Marek
Published on 2010-03-08T08:50:11Z Indexed on 2010/04/04 17:23 UTC
Read the original article Hit count: 371

Filed under:
|
|
|
|

I have been searching for a tool to debug unreleased COM references, that usually cause e.g. Word/Outlook processes to hang in memory in case the code does not call Marshal.ReleaseCOMObject on all COM instances correctly. (Outlook 2007 partially fixes this for outlook addins, but this is a generic question).

Is there a tool that would display at least a list of COM references (by type) held by managed code? Ideally, it would also display memory profiler-style object trees helping to debug where the reference increment occured.

Debugging at runtime is not that important as being able to attach to a hung process - because the problem typically occurs when the code is done with the COM interface and someone forgot to release something - the application (e.g. winword) hangs in memory even after the calling managed application quits.

If such tool does not exist, what is the (technical?) reason? It would be very useful for debugging a lot of otherwise very hard to find problems when working with COM interop.

© Stack Overflow or respective owner

Related posts about com

Related posts about c#