[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

How to debug interop problems?

BrianH

3/14/2007 7:18:00 PM

I'm getting the infamous "COM object has become separated from it's RCW"
messages when I exit from the application hosting my managed-code add-in
(C#). This only happens if I execute code that displays a Windows.Forms
dialog box with controls, even if only a text label and ok button.

I put a messagebox display in the form's Dispose method override, and
observe that the COM error messages are coming before the Dispose method
is called by the GC (or whatever). To me, this should suggest that the
form and all it's components are still around when COM starts releasing
managed objects, so why/how has anything become disconnected?

When things like this happen, how can you pinpoint the root cause, i.e.,
the actual objects that have become disconnected?

Thanks,

BrianH