I create a COM object used for automation tasks of some application. When this happens application is started and its' main window is displayed.
The problem happens when user closes the main application window. Next Invoke call to the COM object does not work. The problem is that it does not fail and it does not report an error. If I put a debugger breakpoint in next line of code, it is never reached. If I surround the Invoke call with try/catch, no exception is caught. In release build it just crashes.
How is this supposed to work? Since I use CComDispatchDriver as a wrapper around IDispatch* I would expect that my AddRef would keep the COM object alive even if user closed the application. I was hoping of at least getting some HRESULT as an error.