Accessibility: NVDA emits errors in WT1.15 preview #18331

Closed
opened 2026-01-31 06:10:37 +00:00 by claunia · 6 comments
Owner

Originally created by @LeonarddeR on GitHub (Aug 28, 2022).

Originally assigned to: @carlos-zamora on GitHub.

Windows Terminal version

1.15.2283.0

Windows build number

25188.1000

Other Software

NVDA 2022.2.2

Steps to reproduce

  1. Open bash in windows terminal
  2. type nano /etc/hosts

Expected Behavior

No error in NVDA

Actual Behavior

NVDA emits the following error:

ERROR - NVDAObjects.behaviors.LiveText._monitor (18:21:06.798) - Dynamic_WinTerminalUIAEditableTextWithAutoSelectDetectionUIA._monitorThread (22344):
Error getting or calculating new text
Traceback (most recent call last):
  File "NVDAObjects\behaviors.pyc", line 386, in _monitor
  File "NVDAObjects\behaviors.pyc", line 350, in _getText
  File "diffHandler.pyc", line 62, in _getText
  File "baseObject.pyc", line 26, in __get__
  File "NVDAObjects\UIA\__init__.pyc", line 848, in _get_text
  File "NVDAObjects\UIA\__init__.pyc", line 555, in _getTextFromUIARange
  File "monkeyPatches\comtypesMonkeyPatches.pyc", line 32, in __call__
_ctypes.COMError: (-2147467259, 'Unspecified error', (None, None, None, 0, None))

I wasn't able to reproduce this with WT1.14, so therefore I'm filing this here since there might be a regression in UIA related code. @codeofdusk could you reproduce this?

Originally created by @LeonarddeR on GitHub (Aug 28, 2022). Originally assigned to: @carlos-zamora on GitHub. ### Windows Terminal version 1.15.2283.0 ### Windows build number 25188.1000 ### Other Software NVDA 2022.2.2 ### Steps to reproduce 1. Open bash in windows terminal 2. type nano /etc/hosts ### Expected Behavior No error in NVDA ### Actual Behavior NVDA emits the following error: ``` ERROR - NVDAObjects.behaviors.LiveText._monitor (18:21:06.798) - Dynamic_WinTerminalUIAEditableTextWithAutoSelectDetectionUIA._monitorThread (22344): Error getting or calculating new text Traceback (most recent call last): File "NVDAObjects\behaviors.pyc", line 386, in _monitor File "NVDAObjects\behaviors.pyc", line 350, in _getText File "diffHandler.pyc", line 62, in _getText File "baseObject.pyc", line 26, in __get__ File "NVDAObjects\UIA\__init__.pyc", line 848, in _get_text File "NVDAObjects\UIA\__init__.pyc", line 555, in _getTextFromUIARange File "monkeyPatches\comtypesMonkeyPatches.pyc", line 32, in __call__ _ctypes.COMError: (-2147467259, 'Unspecified error', (None, None, None, 0, None)) ``` I wasn't able to reproduce this with WT1.14, so therefore I'm filing this here since there might be a regression in UIA related code. @codeofdusk could you reproduce this?
Author
Owner

@codeofdusk commented on GitHub (Aug 30, 2022):

I've also seen this, but not with wtNotifications.

This is probably related to broken assumptions when switching to/from the alt buffer.

@codeofdusk commented on GitHub (Aug 30, 2022): I've also seen this, but not with `wtNotifications`. This is probably related to broken assumptions when switching to/from the alt buffer.
Author
Owner

@LeonarddeR commented on GitHub (Sep 1, 2022):

This error indeed has nothing to do with the notifications implementation.

CC @carlos-zamora just want to make sure that this bug doesn't end up in a release, since that would be annoying for many sr users.

@LeonarddeR commented on GitHub (Sep 1, 2022): This error indeed has nothing to do with the notifications implementation. CC @carlos-zamora just want to make sure that this bug doesn't end up in a release, since that would be annoying for many sr users.
Author
Owner

@carlos-zamora commented on GitHub (Sep 1, 2022):

@leonardder (or @codeofdusk since you're familiar with the space) I think I need a little more context here. It looks like NVDA is calling the UIA API GetText() off of a TextRange. That corresponds to the following code in Windows Terminal: f2a691863b/src/types/UiaTextRangeBase.cpp (L954-L1023)

It looks like we emit an error if...

  1. the second parameter (the out param) wasn't provided properly
  2. the first parameter (dictating the max length) is less than -1
  3. the newly created terminal content isn't fully initialized yet
  4. we're out of memory and we can't create the string result to return
  5. (as @codeofdusk said) the text range points to content that doesn't exist (this is a quick-n-easy way to invalidate a text range that was on the alt buffer when we're now on the main buffer)

I assume the main culprit here is number 5, but to be certain, could you provide the following:

  • What UIA APIs was NVDA calling? Obviously GetText() is the one that returns an error, but what were the calls leading up to that.
  • If you can explain how I can get a trace from NVDA, that'd be even better.
@carlos-zamora commented on GitHub (Sep 1, 2022): @leonardder (or @codeofdusk since you're familiar with the space) I think I need a little more context here. It looks like NVDA is calling the UIA API `GetText()` off of a `TextRange`. That corresponds to the following code in Windows Terminal: https://github.com/microsoft/terminal/blob/f2a691863bb4add22d225ca4f912345eb815a8d9/src/types/UiaTextRangeBase.cpp#L954-L1023 It looks like we emit an error if... 1. the second parameter (the out param) wasn't provided properly 2. the first parameter (dictating the max length) is less than -1 3. the newly created terminal content isn't fully initialized yet 4. we're out of memory and we can't create the string result to return 5. (as @codeofdusk said) the text range points to content that doesn't exist (this is a quick-n-easy way to invalidate a text range that was on the alt buffer when we're now on the main buffer) I assume the main culprit here is number 5, but to be certain, could you provide the following: - What UIA APIs was NVDA calling? Obviously `GetText()` is the one that returns an error, but what were the calls leading up to that. - If you can explain how I can get a trace from NVDA, that'd be even better.
Author
Owner

@carlos-zamora commented on GitHub (Sep 1, 2022):

Yeah, that error code is E_FAIL so it's 100% that alt buffer thing.

@carlos-zamora commented on GitHub (Sep 1, 2022): Yeah, that error code is `E_FAIL` so it's 100% that alt buffer thing.
Author
Owner

@ghost commented on GitHub (Sep 13, 2022):

:tada:This issue was addressed in #13907, which has now been successfully released as Windows Terminal v1.15.252.🎉

Handy links:

@ghost commented on GitHub (Sep 13, 2022): :tada:This issue was addressed in #13907, which has now been successfully released as `Windows Terminal v1.15.252`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.15.252) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@ghost commented on GitHub (Sep 13, 2022):

:tada:This issue was addressed in #13907, which has now been successfully released as Windows Terminal Preview v1.16.252.🎉

Handy links:

@ghost commented on GitHub (Sep 13, 2022): :tada:This issue was addressed in #13907, which has now been successfully released as `Windows Terminal Preview v1.16.252`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.16.252) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18331