Windows UIAutomation "The object invoked has disconnected from its clients" when application ends?

0

In a smaller test program using UIAuotmation and CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) I have no problems running in x64 debug mode in VS2017. On a larger MFC app (x64 debug) that uses AfxOleInit() I get the The object invoked has disconnected from its clients when exiting the app if the UIAutomation object did something like call IUIAutomation::ElementFromHandle(). Creating only the initial IUIAutomation object itself (i.e. CoCreateInstance(CLSID_CUIAutomation, NULL, CLSCTX_INPROC_SERVER, IID_IUIAutomation, reinterpret_cast<void**>(&m_pClientUIA)); does not cause the issue.

I note the following as soon as the IUIAutomation::ElementFromHandle() method is called, the output window shows:

mincore\com\oleaut32\dispatch\ups.cpp(2125)\OLEAUT32.dll!00007FFB2155491B: (caller: 00007FFB21554A92) ReturnHr(2) tid(4cfc) 8002801D Library not registered.
'myapp.exe' (Win32): Loaded 'C:\Windows\System32\UiaManager.dll'. Cannot find or open the PDB file.

Later the IUIAutomation object "m_pClientUIA" (and anything else related to UIAutomation) is released without any issues. Only once the app is terminating, you get two exception thrown dialogs with:

Exception thrown at 0x00007FFB1EDDA799 (KernelBase.dll) in myapp.exe: 0x80010108: The object invoked has disconnected from its clients.

Any ideas on what is causing this and if it's anything I should worry about or just suppress?

Thanks.

winapi
com
ui-automation
ole
microsoft-ui-automation
asked on Stack Overflow Jul 27, 2020 by user3161924

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0