I have some COM component which I call from some c# dll.

I also have a winforms app that uses that .dll.

When I close the app I get this exception:

COM object that has been separated from its underlying RCW cannot be used.

The stack trace shows this exception comes from a destructor in the .dll. I implemented this destructor to call some cleanup method in the COM.

Why does this happen? How is it best to solve it?

Edit
Report