Repository: nvaccess/nvda

Issue:
eskype for business - keeps giving error sounds with nvda 
When using skype for  business with nvda master 14008 skype for business generates error sounds.
When opening the loggs I see some erros:
ERROR - eventHandler.executeEvent (08:45:56):
error executing event: gainFocus on <NVDAObjects.Dynamic_EditableTextWithoutAutoSelectDetectionUIA object at 0x02EDFBF0> with extra args of {}
Traceback (most recent call last):
  File "eventHandler.pyc", line 143, in executeEvent
  File "eventHandler.pyc", line 91, in __init__
  File "eventHandler.pyc", line 98, in next
  File "C:\Users\itall101\AppData\Roaming\nvda\addons\remote\globalPlugins\remoteClient\__init__.py", line 310, in event_gainFocus
  File "eventHandler.pyc", line 98, in next
  File "NVDAObjects\__init__.pyc", line 899, in event_gainFocus
  File "NVDAObjects\__init__.pyc", line 811, in reportFocus
  File "speech.pyc", line 367, in speakObject
  File "speech.pyc", line 689, in speakTextInfo
  File "NVDAObjects\UIA\__init__.pyc", line 584, in getTextWithFields
  File "NVDAObjects\UIA\__init__.pyc", line 574, in _getTextWithFieldsForUIARange
  File "NVDAObjects\UIA\__init__.pyc", line 409, in _getTextWithFields_text
  File "NVDAObjects\UIA\__init__.pyc", line 213, in _getFormatFieldAtRange
  File "UIAUtils.pyc", line 173, in getValue
Although I am not a software developer, I can't relate the mensioned actions towards skype for business, but I can reproduce this issue and the samme erors will apear in the log file.



Discussion:
I'm also having this problem.
This is bad because it is not possible to review the characters and words in the edit field of a new message.
Has this always happened? If not, in what version did it start occurring?

Also, the log fragment you pasted does not include the bottom line (or
perhaps few lines) which specifies the actual exception. Can you please
paste a more complete log fragment? Alternatively, if you're not sure which
part of the log to paste, please attach a full, zipped log file. Thanks.

On the machine where I am with error in Skype for Business I am using nvda next 14017 on windows 7 64bits and office 2013 ver. 15.0.4983.1000 32bits.
I noticed the error from the next nvda 13949
To reproduce the error, When entering Skype for Business press tab up to the contact list, navigate with the arrows to a contact, and press enter to start a chat conversation.
When you enter the chat window you will hear an error sound.
Now enter a text, and press left arrow to navigate the inserted text, you are expected to have the characters read, which occurs is that an error sound is reproduced and the entered character is not read.
The log follows below:

IO - inputCore.InputManager.executeGesture (09:44:59):
Input: kb(laptop):enter
IO - speech.speak (09:44:59):
Speaking [u'Rodrigo Martins De Lima']
IO - speech.speak (09:44:59):
Speaking [u'bot\xe3o']
IO - speech.speak (09:44:59):
Speaking [u'bot\xe3o']
IO - speech.speak (09:44:59):
Speaking [u'Entrada de Chat. Conversa com Rodrigo Martins De Lima  edi\xe7\xe3o']
ERROR - eventHandler.executeEvent (09:44:59):
error executing event: gainFocus on <NVDAObjects.Dynamic_EditableTextWithoutAutoSelectDetectionUIA object at 0x05E5EE70> with extra args of {}
Traceback (most recent call last):
  File "eventHandler.pyc", line 143, in executeEvent
  File "eventHandler.pyc", line 91, in __init__
  File "eventHandler.pyc", line 98, in next
  File "C:\Users\a50596\AppData\Roaming\nvda\addons\easyTableNavigator\globalPlugins\easyTableNavigator.py", line 82, in event_gainFocus
  File "eventHandler.pyc", line 98, in next
  File "C:\Users\a50596\AppData\Roaming\nvda\addons\enhancedTouchGestures\globalPlugins\enhancedTouchGestures.py", line 94, in event_gainFocus
  File "eventHandler.pyc", line 98, in next
  File "C:\Users\a50596\AppData\Roaming\nvda\addons\AudioThemes\globalPlugins\AudioThemes\__init__.py", line 72, in event_gainFocus
  File "eventHandler.pyc", line 98, in next
  File "C:\Users\a50596\AppData\Roaming\nvda\addons\remote\globalPlugins\remoteClient\__init__.py", line 410, in event_gainFocus
  File "eventHandler.pyc", line 98, in next
  File "C:\Users\a50596\AppData\Roaming\nvda\addons\focusHighlight\globalPlugins\focusHighlight.py", line 621, in event_gainFocus
  File "eventHandler.pyc", line 98, in next
  File "C:\Users\a50596\AppData\Roaming\nvda\addons\wintenApps\globalPlugins\wintenObjs\__init__.py", line 199, in event_gainFocus
  File "eventHandler.pyc", line 98, in next
  File "C:\Users\a50596\AppData\Roaming\nvda\addons\Favorite folders\globalPlugins\FavoriteFolders\__init__.py", line 161, in event_gainFocus
  File "eventHandler.pyc", line 98, in next
  File "NVDAObjects\__init__.pyc", line 908, in event_gainFocus
  File "NVDAObjects\__init__.pyc", line 820, in reportFocus
  File "speech.pyc", line 368, in speakObject
  File "speech.pyc", line 719, in speakTextInfo
  File "NVDAObjects\UIA\__init__.pyc", line 584, in getTextWithFields
  File "NVDAObjects\UIA\__init__.pyc", line 574, in _getTextWithFieldsForUIARange
  File "NVDAObjects\UIA\__init__.pyc", line 409, in _getTextWithFields_text
  File "NVDAObjects\UIA\__init__.pyc", line 213, in _getFormatFieldAtRange
  File "UIAUtils.pyc", line 173, in getValue
COMError: (-2147220988, 'Um nome de campo inv\xe1lido foi usado em uma cadeia de caracteres de consulta', (None, None, None, 0, None))
IO - inputCore.InputManager.executeGesture (09:45:04):
Input: kb(laptop):t
IO - speech._speakSpellingGen (09:45:04):
Speaking character u't'
IO - inputCore.InputManager.executeGesture (09:45:04):
Input: kb(laptop):e
IO - speech._speakSpellingGen (09:45:04):
Speaking character u'e'
IO - inputCore.InputManager.executeGesture (09:45:05):
Input: kb(laptop):s
IO - speech._speakSpellingGen (09:45:05):
Speaking character u's'
IO - inputCore.InputManager.executeGesture (09:45:05):
Input: kb(laptop):t
IO - speech._speakSpellingGen (09:45:05):
Speaking character u't'
IO - inputCore.InputManager.executeGesture (09:45:05):
Input: kb(laptop):e
IO - speech._speakSpellingGen (09:45:05):
Speaking character u'e'
IO - inputCore.InputManager.executeGesture (09:45:06):
Input: kb(laptop):space
DEBUGWARNING - NVDAObjects.NVDAObject._reportErrorInPreviousWord (09:45:06):
Error fetching last character of previous word
Traceback (most recent call last):
  File "NVDAObjects\__init__.pyc", line 832, in _reportErrorInPreviousWord
  File "NVDAObjects\UIA\__init__.pyc", line 584, in getTextWithFields
  File "NVDAObjects\UIA\__init__.pyc", line 574, in _getTextWithFieldsForUIARange
  File "NVDAObjects\UIA\__init__.pyc", line 409, in _getTextWithFields_text
  File "NVDAObjects\UIA\__init__.pyc", line 213, in _getFormatFieldAtRange
  File "UIAUtils.pyc", line 173, in getValue
COMError: (-2147220988, 'Um nome de campo inv\xe1lido foi usado em uma cadeia de caracteres de consulta', (None, None, None, 0, None))
IO - speech.speakTypedCharacters (09:45:06):
typed word: teste
IO - speech.speak (09:45:06):
Speaking [u'teste']
IO - speech._speakSpellingGen (09:45:06):
Speaking character u'espa\xe7o'
IO - inputCore.InputManager.executeGesture (09:45:07):
Input: kb(laptop):leftArrow
ERROR - scriptHandler.executeScript (09:45:07):
error executing script: <bound method Dynamic_EditableTextWithoutAutoSelectDetectionUIA.script_caret_moveByCharacter of <NVDAObjects.Dynamic_EditableTextWithoutAutoSelectDetectionUIA object at 0x05E5EE70>> with gesture u'esquerda'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 187, in executeScript
  File "editableText.pyc", line 147, in script_caret_moveByCharacter
  File "editableText.pyc", line 103, in _caretMovementScriptHelper
  File "editableText.pyc", line 89, in _caretScriptPostMovedHelper
  File "speech.pyc", line 719, in speakTextInfo
  File "NVDAObjects\UIA\__init__.pyc", line 584, in getTextWithFields
  File "NVDAObjects\UIA\__init__.pyc", line 574, in _getTextWithFieldsForUIARange
  File "NVDAObjects\UIA\__init__.pyc", line 409, in _getTextWithFields_text
  File "NVDAObjects\UIA\__init__.pyc", line 213, in _getFormatFieldAtRange
  File "UIAUtils.pyc", line 173, in getValue
COMError: (-2147220988, 'Um nome de campo inv\xe1lido foi usado em uma cadeia de caracteres de consulta', (None, None, None, 0, None))
IO - inputCore.InputManager.executeGesture (09:45:08):
Input: kb(laptop):leftArrow
ERROR - scriptHandler.executeScript (09:45:08):
error executing script: <bound method Dynamic_EditableTextWithoutAutoSelectDetectionUIA.script_caret_moveByCharacter of <NVDAObjects.Dynamic_EditableTextWithoutAutoSelectDetectionUIA object at 0x05E5EE70>> with gesture u'esquerda'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 187, in executeScript
  File "editableText.pyc", line 147, in script_caret_moveByCharacter
  File "editableText.pyc", line 103, in _caretMovementScriptHelper
  File "editableText.pyc", line 89, in _caretScriptPostMovedHelper
  File "speech.pyc", line 719, in speakTextInfo
  File "NVDAObjects\UIA\__init__.pyc", line 584, in getTextWithFields
  File "NVDAObjects\UIA\__init__.pyc", line 574, in _getTextWithFieldsForUIARange
  File "NVDAObjects\UIA\__init__.pyc", line 409, in _getTextWithFields_text
  File "NVDAObjects\UIA\__init__.pyc", line 213, in _getFormatFieldAtRange
  File "UIAUtils.pyc", line 173, in getValue
COMError: (-2147220988, 'Um nome de campo inv\xe1lido foi usado em uma cadeia de caracteres de consulta', (None, None, None, 0, None))
IO - inputCore.InputManager.executeGesture (09:45:09):
Input: kb(laptop):NVDA+f1
INFO - globalCommands.GlobalCommands.script_navigatorObject_devInfo (09:45:10):
Developer info for navigator object:
name: u'Entrada de Chat. Conversa com Rodrigo Martins De Lima'
role: ROLE_EDITABLETEXT
states: STATE_FOCUSABLE, STATE_FOCUSED
isFocusable: True
hasFocus: True
Python object: <NVDAObjects.Dynamic_EditableTextWithoutAutoSelectDetectionUIA object at 0x05E5EE70>
Python class mro: (<class 'NVDAObjects.Dynamic_EditableTextWithoutAutoSelectDetectionUIA'>, <class 'NVDAObjects.behaviors.EditableTextWithoutAutoSelectDetection'>, <class 'editableText.EditableTextWithoutAutoSelectDetection'>, <class 'NVDAObjects.behaviors.EditableText'>, <class 'editableText.EditableText'>, <class 'NVDAObjects.UIA.UIA'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 'object'>)
description: ''
location: (121, 415, 388, 41)
value: u'teste \r'
appModule: <'appModuleHandler' (appName u'lync', process ID 4772) at address 5e5ed50>
appModule.productName: u'Microsoft Office 2013'
appModule.productVersion: u'15.0.4893.1000'
TextInfo: <class 'NVDAObjects.UIA.UIATextInfo'>
windowHandle: 197774
windowClassName: u'NetUIHWND'
windowControlID: 0
windowStyle: 1442840576
windowThreadID: 4776
windowText: u''
displayText: u''
UIAElement: <POINTER(IUIAutomationElement) ptr=0x4386940 at 5cba990>
UIA automationID: idAutomationChatInput
UIA frameworkID: 
UIA runtimeID: (42, 197774, 2, 392222728, 0)
UIA providerDescription: [pid:4772,hwnd:0x0 Main(parent link):Unidentified Provider (unmanaged:lync.exe)]
UIA className: NetUIRicherTextbox

Can you reproduce this with NVDA 2017.1?

@MichaelDCurran, looks like a regression introduced by the UIA caching stuff. Occurs when calling TextRange.GetAttributeValue. The error message in English is "An invalid field name was used in a query string".
Setting to p1 for now, as it looks like a UIA regression. @MichaelDCurran, feel free to drop priority if you disagree, since you know this code better.
In nvda 2017.1 I could not reproduce the error, everything works fine.
Can you please give clear steps to reproduce. Right from opening Skype for business, choosing a contact, typing an IM, reviewing it etc.  I'm not getting any errors with current NVDA next.  But it is also possible that the bug was fixed in a later version of Office 2016. I'm running 16.0.7967.2139. What exact version of Windows and Office are you running?

Resolving patch:
diff --git a/source/UIAUtils.py b/source/UIAUtils.py
--- a/source/UIAUtils.py
+++ b/source/UIAUtils.py
@@ -170,7 +170,11 @@ def __init__(self,textRange):
 		self.textRange=textRange
 
 	def getValue(self,ID,ignoreMixedValues=False):
-		val=self.textRange.getAttributeValue(ID)
+		try:
+			val=self.textRange.getAttributeValue(ID)
+		except COMError:
+			# #7124: some text attributes are not supported in  older Operating Systems 
+			return UIAHandler.handler.reservedNotSupportedValue
 		if not ignoreMixedValues and val==UIAHandler.handler.ReservedMixedAttributeValue:
 			raise UIAMixedAttributeError
 		return val


Test patch: