Ghost/dummy window appears in the task bar (DesktopWindowXamlSource) #9027

Closed
opened 2026-01-31 01:44:09 +00:00 by claunia · 9 comments
Owner

Originally created by @ocalvo on GitHub (Jun 15, 2020).

Environment

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
 Win32NT             10.0.19041.0 Microsoft Windows NT 10.0.19041.0

Windows Terminal version (if applicable):
Windows Terminal Preview
Version: 1.1.1611.0

Any other software?

Steps to reproduce

  1. Start Windows Terminal on PowerShell
  2. Start wsl

Expected behavior

Only one mini window should show on the task bar

Actual behavior

Two mini windows are shown in the task bar:
2020-06-14 (1)

The second window shown is the CoreWindow, this is a known issue with Xaml Islands version 1.0.
The workaround is to hide the core window hWnd by calling ::ShowWindow(hWnd, SW_HIDE)

Originally created by @ocalvo on GitHub (Jun 15, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] Win32NT 10.0.19041.0 Microsoft Windows NT 10.0.19041.0 Windows Terminal version (if applicable): Windows Terminal Preview Version: 1.1.1611.0 Any other software? ``` # Steps to reproduce 1. Start Windows Terminal on PowerShell 2. Start wsl <!-- A description of how to trigger this bug. --> # Expected behavior Only one mini window should show on the task bar <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior Two mini windows are shown in the task bar: <img width="336" alt="2020-06-14 (1)" src="https://user-images.githubusercontent.com/2091582/84608486-91405b80-ae67-11ea-90eb-b66bcd042143.png"> <!-- What's actually happening? --> The second window shown is the CoreWindow, this is a known issue with Xaml Islands version 1.0. The workaround is to hide the core window hWnd by calling `::ShowWindow(hWnd, SW_HIDE)`
Author
Owner

@DHowett commented on GitHub (Jun 15, 2020):

I don’t believe this happens every time; the extra window usually goes away after it’s been parented. Do you know what causes it to stick around?

When hosting an island, we only have two windows: the terminal Win32 window, and the “interop HWND” we get from DWXS. Since the interop HWND is the one we parent to the terminal window, I’m worried that hiding it will hide our XAML content.

I’m hoping you know a way to get the best of both worlds :)

@DHowett commented on GitHub (Jun 15, 2020): I don’t believe this happens every time; the extra window usually goes away after it’s been parented. Do you know what causes it to stick around? When hosting an island, we only have two windows: the terminal Win32 window, and the “interop HWND” we get from DWXS. Since the interop HWND is the one we parent to the terminal window, I’m worried that hiding it will hide our XAML content. I’m hoping you know a way to get the best of both worlds :)
Author
Owner

@ghost commented on GitHub (Jun 19, 2020):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Jun 19, 2020): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@zadjii-msft commented on GitHub (Dec 9, 2021):

Hey @ocalvo, any idea if the root xaml islands bug was solved in Windows 11? I haven't seen this in quite some time now, so maybe it got fixed on your side?

I suppose even in Windows 10, we should be ShowWindow(hWnd, SW_HIDE)'ing the _interopWindowHandle around here: https://github.com/microsoft/terminal/blob/main/src/cascadia/WindowsTerminal/IslandWindow.cpp#L311, yea? Will that really not hide our XAML content?

@zadjii-msft commented on GitHub (Dec 9, 2021): Hey @ocalvo, any idea if the root xaml islands bug was solved in Windows 11? I haven't seen this in quite some time now, so maybe it got fixed on your side? I suppose even in Windows 10, we should be `ShowWindow(hWnd, SW_HIDE)`'ing the `_interopWindowHandle` around here: https://github.com/microsoft/terminal/blob/main/src/cascadia/WindowsTerminal/IslandWindow.cpp#L311, yea? Will that really not hide our XAML content?
Author
Owner

@DHowett commented on GitHub (Dec 9, 2021):

I think W11 shipped with the DWXS window hidden by default!

We should do the hide still -- and yeah, it shouldn't hide our XAML content.

@DHowett commented on GitHub (Dec 9, 2021): I think W11 shipped with the DWXS window hidden by default! We should do the hide still -- and yeah, it shouldn't hide our XAML content.
Author
Owner

@zadjii-msft commented on GitHub (Dec 9, 2021):

Easy enough to test out, thanks for the confirmation!

@zadjii-msft commented on GitHub (Dec 9, 2021): Easy enough to test out, thanks for the confirmation!
Author
Owner

@MouriNaruto commented on GitHub (Mar 18, 2023):

Here is my solution for that and hope to give you some help:

        // Prevent showing the dummy/empty/ghost DesktopWindowXamlSource window
        // in the task bar.
        // Reference: https://github.com/microsoft/terminal/issues/6507
        // Reference: https://github.com/microsoft/microsoft-ui-xaml/issues/6490
        // Fixes: https://github.com/M2Team/NanaZip/issues/225
        // For also fixing the window with empty content due to CoreWindow is
        // not exist issue, create a host window without message loop is a
        // better workaround.
        g_CoreWindowHostWindowHandle = ::CreateWindowExW(
            0,
            L"Mile.Xaml.ContentWindow",
            L"Mile.Xaml.CoreWindowHostWindow",
            0,
            CW_USEDEFAULT,
            0,
            CW_USEDEFAULT,
            0,
            nullptr,
            nullptr,
            nullptr,
            winrt::get_abi(winrt::Grid()));
        winrt::check_pointer(g_CoreWindowHostWindowHandle);

Note: This workaround should be used as soon as possible after first calling WindowsXamlManager::InitializeForCurrentThread(), and only need to use once. (Of course, should before any other XAML Islands content hosting windows.)

Reference: c5c7af247f/Mile.Xaml/Mile.Xaml.cpp (L519-L540)

Kenji Mouri

@MouriNaruto commented on GitHub (Mar 18, 2023): Here is my solution for that and hope to give you some help: ``` // Prevent showing the dummy/empty/ghost DesktopWindowXamlSource window // in the task bar. // Reference: https://github.com/microsoft/terminal/issues/6507 // Reference: https://github.com/microsoft/microsoft-ui-xaml/issues/6490 // Fixes: https://github.com/M2Team/NanaZip/issues/225 // For also fixing the window with empty content due to CoreWindow is // not exist issue, create a host window without message loop is a // better workaround. g_CoreWindowHostWindowHandle = ::CreateWindowExW( 0, L"Mile.Xaml.ContentWindow", L"Mile.Xaml.CoreWindowHostWindow", 0, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, nullptr, winrt::get_abi(winrt::Grid())); winrt::check_pointer(g_CoreWindowHostWindowHandle); ``` Note: This workaround should be used as soon as possible after first calling `WindowsXamlManager::InitializeForCurrentThread()`, and only need to use once. (Of course, should before any other XAML Islands content hosting windows.) Reference: https://github.com/ProjectMile/Mile.Xaml/blob/c5c7af247f7182b94e3e64ae467b8bd823df5a1c/Mile.Xaml/Mile.Xaml.cpp#L519-L540 Kenji Mouri
Author
Owner

@nathpete-msft commented on GitHub (Apr 11, 2023):

I'm also experiencing this on launch at startup or just via opening the app normally from the start menu or taskbar.

Windows Terminal 1.18.902.0
Windows 10 22H2 19045.2728

@nathpete-msft commented on GitHub (Apr 11, 2023): I'm also experiencing this on launch at startup or just via opening the app normally from the start menu or taskbar. Windows Terminal 1.18.902.0 Windows 10 22H2 19045.2728
Author
Owner

@samkearney commented on GitHub (Oct 29, 2023):

I am having this issue on the newest version of Windows Terminal as of this writing, 1.18.2822.0. I believe it started happening after my company recently pushed an update to our workstations to Windows 10 22H2 build 19045.3570.

image

@samkearney commented on GitHub (Oct 29, 2023): I am having this issue on the newest version of Windows Terminal as of this writing, 1.18.2822.0. I believe it started happening after my company recently pushed an update to our workstations to Windows 10 22H2 build 19045.3570. ![image](https://github.com/microsoft/terminal/assets/5142299/d9d71e06-1ea9-4747-9dc6-c143c6f241b1)
Author
Owner

@j4james commented on GitHub (Oct 29, 2023):

@samkearney I think the new instance of this bug is being tracked in #16183 now. You may want to follow up there.

@j4james commented on GitHub (Oct 29, 2023): @samkearney I think the new instance of this bug is being tracked in #16183 now. You may want to follow up there.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9027