microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.76k stars 8.33k forks source link

[Windows Terminal - Settings]: 'Settings' tab does not open in high contrast 'Aquatic' or 'Desert' themes. #17915

Closed SaurabhNew closed 2 weeks ago

SaurabhNew commented 2 months ago

Windows Terminal version

1.22.2362.0

Windows build number

27695.1000

Other Software

Test Environment: OS: Windows 11 Version Dev (OS Build 27695.1000) App: Windows Terminal Preview

Steps to reproduce

Pre-requisite: Settings>Accessibility>Contrast themes>Aquatic/Desert theme>Reopen the application.

Repro steps:

  1. Open the 'windows terminal' application.
  2. Follow the above-mentioned pre-requisite step.
  3. Now open any application like 'Windows Terminal'.
  4. Now try to open 'Settings' window by pressing 'Ctrl+,' keys or form drop down.
  5. Observe the issue.

User experience: Users relying on high contrast themes for better visibility are unable to access the 'Settings' tab, limiting their ability to configure or modify terminal settings. This creates a significant barrier for users who need high contrast for accessibility purposes.

MAS Reference Link: MAS 4.3.1 – No Disruption of Accessibility Features.docx (sharepoint.com)

Attachment: Settings window is not opening in high contrast themes.zip

Expected Behavior

The 'Settings' tab should open properly regardless of the theme applied, including high contrast themes such as 'Aquatic' and 'Desert.'

Actual Behavior

The 'Settings' tab does not open when the high contrast 'Aquatic' or 'Desert' themes are applied. The issue is specific to these high contrast themes, as the tab opens normally in simple or dark themes.

carlos-zamora commented 3 weeks ago

Did a bit of research on this. Surprisingly, this does not repro on a Dev build when I have a debugger attached, but it does repro on WT Canary!

I attached a debugger to WT canary and got a repro. Here's some relevant output:

onecore\com\combase\objact\objact.cxx(4070)\combase.dll!00007FF8678FA7ED: (caller: 00007FF8678FA115) ReturnHr(1565) tid(6518) 80040154 Class not registered
onecore\com\combase\dcomrem\resolver.cxx(2217)\combase.dll!00007FF8678F9613: (caller: 00007FF8678FE08B) ReturnHr(1566) tid(6518) 80040154 Class not registered
onecore\com\combase\dcomrem\resolver.cxx(2420)\combase.dll!00007FF8678FE127: (caller: 00007FF8678FF9B9) ReturnHr(1567) tid(6518) 80040154 Class not registered
C:\__w\1\s\src\cascadia\TerminalSettingsEditor\Generated Files\winrt\base.h(2017)\Microsoft.Terminal.Settings.Editor.dll!00007FFF86ABA3EF: LogHr(7) tid(6518) 80004002 No such interface supported
    [struct winrt::Windows::Foundation::IReference<struct winrt::Windows::UI::Color> __cdecl winrt::impl::as<struct winrt::Windows::Foundation::IReference<struct winrt::Windows::UI::Color>,struct winrt::impl::abi<struct winrt::Windows::Foundation::IUnknown,void>::type,0x0>(struct winrt::impl::abi<struct winrt::Windows::Foundation::IUnknown,void>::type *)]
Exception thrown at 0x00007FF866C9138C (KernelBase.dll) in WindowsTerminal.exe: WinRT originate error - 0x80004002 : 'No such interface supported'.
C:\__w\1\s\src\cascadia\TerminalSettingsEditor\Generated Files\winrt\base.h(2017)\Microsoft.Terminal.Settings.Editor.dll!00007FFF86A8AC0F: LogHr(8) tid(6518) 80004002 No such interface supported
    [struct winrt::Windows::Foundation::IReference<struct winrt::Windows::UI::Color> __cdecl winrt::impl::as<struct winrt::Windows::Foundation::IReference<struct winrt::Windows::UI::Color>,struct winrt::impl::abi<struct winrt::Windows::Foundation::IUnknown,void>::type,0x0>(struct winrt::impl::abi<struct winrt::Windows::Foundation::IUnknown,void>::type *)]
Exception thrown at 0x00007FF866C9138C in WindowsTerminal.exe: Microsoft C++ exception: winrt::hresult_no_interface at memory location 0x000000FB352FCB10.
Exception thrown at 0x00007FF866C9138C in WindowsTerminal.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Microsoft.Terminal.Settings.Editor.dll!00007FFF86C5C21F: ReturnHr(6) tid(6518) 80004002 No such interface supported
    Msg:[winrt::hresult_error: No such interface supported] 
C:\__w\1\s\src\cascadia\TerminalApp\Generated Files\winrt\Microsoft.Terminal.Settings.Editor.h(2352)\TerminalApp.dll!00007FFF96AE218B: LogHr(25) tid(6518) 80004002 No such interface supported
    [auto __cdecl winrt::impl::consume_Microsoft_Terminal_Settings_Editor_IMainPageFactory<struct winrt::Microsoft::Terminal::Settings::Editor::IMainPageFactory>::CreateInstance(const struct winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings &) const]
Exception thrown at 0x00007FF866C9138C in WindowsTerminal.exe: Microsoft C++ exception: winrt::hresult_no_interface at memory location 0x000000FB352FCDD0.
Exception thrown at 0x00007FF866C9138C in WindowsTerminal.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
C:\__w\1\s\src\cascadia\inc\cppwinrt_utils.h(57)\TerminalApp.dll!00007FFF96B641E6: (caller: 00007FFF96B330F3) LogHr(26) tid(6518) 80004002 No such interface supported
    Msg:[winrt::hresult_error: No such interface supported] 
onecore\com\combase\objact\objact.cxx(4070)\combase.dll!00007FF8678FA7ED: (caller: 00007FF8678FA115) ReturnHr(1568) tid(6518) 80040154 Class not registered
onecore\com\combase\dcomrem\resolver.cxx(2217)\combase.dll!00007FF8678F9613: (caller: 00007FF8678FE08B) ReturnHr(1569) tid(6518) 80040154 Class not registered
onecore\com\combase\dcomrem\resolver.cxx(2420)\combase.dll!00007FF8678FE127: (caller: 00007FF8678FF9B9) ReturnHr(1570) tid(6518) 80040154 Class not registered

The suspicious part is IReference<struct winrt::Windows::UI::Color>.

(This part I feel less confident in, but it's still a bit of a lead) Looks like MainPage::_UpdateBackgroundForMica is the only spot in MainPage that uses a WinUI Color. I wonder if the bug is in there?

As for how to validate that this was fixed, I need to test that changing the branding may repro the bug. To do that, I need to take a look at Directory.build.props.

carlos-zamora commented 2 weeks ago

Ok, after some further research, I wasn't able to get this to repro in the following cases:

Dustin was also unable to get a repro. It's also wild because I did get a repro originally, but the debug output above apparently happens even when it doesn't repro.

All that said, we've done a lot of work in this area:

I've validated that high contrast mode should be working in just about all the major surfaces in Terminal.

@SaurabhNew could you validate that this issue is still occurring currently? Or even after we send you a build with the aforementioned High Contrast PRs merged?

carlos-zamora commented 2 weeks ago

If anything, it would probably be fixed by #18130, so actually I'll be closing this as a part of that. We can revisit/reopen if it repros.