From bcfc52245b91e67974d6ad3d91fe910a7347165e Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Wed, 22 Jan 2020 10:35:48 -0800 Subject: [PATCH] Turns out, the bug is in our wrapper class. Not supposed to return nullptr when attribute not found. Don't know why this is an issue _now_ --- .../TerminalControl/XamlUiaTextRange.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalControl/XamlUiaTextRange.cpp b/src/cascadia/TerminalControl/XamlUiaTextRange.cpp index 80a9b623d40..966e0c79068 100644 --- a/src/cascadia/TerminalControl/XamlUiaTextRange.cpp +++ b/src/cascadia/TerminalControl/XamlUiaTextRange.cpp @@ -24,6 +24,18 @@ namespace XamlAutomation namespace winrt::Microsoft::Terminal::TerminalControl::implementation { + // EmptyObject is our equivalent of UIAutomationCore::UiaGetReservedNotSupportedValue() + // This retrieves a value that is interpreted as "not supported". + class EmptyObject : public winrt::implements + { + public: + static IInspectable GetInstance() + { + static auto eo = make_self(); + return eo.as(); + } + }; + XamlAutomation::ITextRangeProvider XamlUiaTextRange::Clone() const { UIA::ITextRangeProvider* pReturn; @@ -88,7 +100,9 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation } else { - return nullptr; + // We _need_ to return an empty object here. + // Returning nullptr is an improper implementation of it being unsupported. + return EmptyObject::GetInstance();//*EmptyObject::GetInstance(); } }