COM object separated from its underlying RCW error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I've gotten this error:

Err# 5 COM object that has been separated from its underlying RCW can not be used

I have researched this some, and have discovered that it has something to do with the threading model used by the app

My VB.NET app is using LeadTools COM objects. This error occurs when the form that contains the LeadTools control is first opened, then closed, then the above error consistently appears during the re-opening of the given form

I need some help in order to avoid running into this error

Any assistance would be appreciated

Thanks

Neal
 
Are you running your COM object methods on the separate thread? or
asynchronously compared to the form? do they modify anything in the form?

-CJ
Neal Miller said:
Hi all,

I've gotten this error:

Err# 5 COM object that has been separated from its underlying RCW can not be used.

I have researched this some, and have discovered that it has something to
do with the threading model used by the app.
My VB.NET app is using LeadTools COM objects. This error occurs when the
form that contains the LeadTools control is first opened, then closed, then
the above error consistently appears during the re-opening of the given
form.
 
I believe that they are running asynchronously compared to the form, because I did not implement my forms as a multi-threading application.

Based on the MS article titled "Implementing Finalize and Dispose to Clean Up Unmanaged Resources", I want to create and call Finalize and Dispose methods on these forms for the LeadTools COM Objects

Thanks

Neal Miller
 
Neal,
I normally see that when I call
System.Runtime.InteropServices.Marshal.ReleaseComObject on an COM variable,
then attempt to call a method of that COM variable.

Remember if you call ReleaseComObject on one variable and that variable
refers to the same instance as a second variable, both variables are
invalidated...

Hope this helps
Jay

Neal Miller said:
Hi all,

I've gotten this error:

Err# 5 COM object that has been separated from its underlying RCW can not be used.

I have researched this some, and have discovered that it has something to
do with the threading model used by the app.
My VB.NET app is using LeadTools COM objects. This error occurs when the
form that contains the LeadTools control is first opened, then closed, then
the above error consistently appears during the re-opening of the given
form.
 
Back
Top