Debugging interop using CS 2005/C#

  • Thread starter Thread starter BrianH
  • Start date Start date
B

BrianH

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
 
Are you handling your COM in a separate object (class) than the Form?.. if
so if that class/object goes out of scope, GC will start releasing its
resources...

or what I am saying is oppsite of your problem?

VJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top