UIA NVDAObject's controllerFor property: catch KeyError seen on Windows 7 due to bad UIA client library marshalling and a limitation in comtypes. (#14275)
Fixes #14270
Summary of the issue:
when searching in the Windows 7 start menu or navigating in Windows 7 Explorer, the NVDA error sound is heard and a traceback is printed to the log at level error.
The exception is a KeyError raised by comtypes, as it does not know how to unpack a variant of type VT_Unknown | VT_Array.
However, the reason this variant is returned in the first place is because the UIA client library directly returns the provider's VT_Unknown | VT_Array variant on Windows 7, Which is useless for a client.
On Newer Windows versions, the client library correctly marshals this to IUIAutomationElementArray per the UI Automation documentation.
Description of user facing changes
No error sound is heard and traceback is only printed to the log at debugWarning.
Description of development approach
Catch KeyError when fetching the UIA_ControllerFor property.
An alternative could have been to limit the fetching of the controllerfor property to versions above Windows 7, but as official windows 7 UI automation documentation states that controllerFor is supported, it is unclear then as to exactly what versions are affected.