Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually hide our DesktopWindowXamlSource #15165

Merged
merged 3 commits into from
Apr 14, 2023

Conversation

zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft commented Apr 11, 2023

As discussed in #6507

Newer builds of Windows do this automatically. However, this was spotted in the wild on 1.18. It's possible the threading changes created a situation where the OS-side fix no longer applied to us. So let's just do it manually. It doesn't have any side effects.

I saw this once on Win11, but couldn't repro it this morning when I tried to add this fix. I'm just gonna assume this worked, despite the fact that I can't repro it on win11 anymore.

closes #6507

See also #14957

detailed description

WindowsXamlManager::XamlCore::Initialize calls ConfigureCoreWindow, which creates a CoreWindow on the thread

Problem is, we're calling that on the main thread (which doesn't have any windows), and then eventually creating a DesktopWindowXamlSource on a second thread for the actual window

It's not that it "manages a window", it's that it "manages xaml on Windows OS". just use ICoreWindowInterop -- QI for ICoreWindowInterop and call get_WindowHandle.

Also see:

As discussed in #6507

Newer builds of Windows do this automatically. However, this was spotted in the wild on 1.18. It's possible the threading changes created a situation where the OS-side fix no longer applied to us. So let's just do it manually. It doesn't have any side effects.

I saw this once on Win11, but couldn't repro it this morning when I tried to add this fix. I'm just gonna assume this worked, despite the fact that I can't repro it on win11 anymore.

closes #6507

See also #14957
@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Priority-2 A description (P2) Product-Terminal The new Windows Terminal. labels Apr 11, 2023
@j4james
Copy link
Collaborator

j4james commented Apr 11, 2023

FYI, I get this DesktopWindowXamlSource thing all the time in the current Dev build of Terminal, and this change doesn't appear to have fixed that. This is on Windows 10 (version 10.0.19045.2728).

Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this needs fixing for & testing on Windows 10. 😟

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Apr 12, 2023
@zadjii-msft zadjii-msft marked this pull request as draft April 12, 2023 18:58
@zadjii-msft
Copy link
Member Author

zadjii-msft commented Apr 13, 2023

Hmm.

These both have the same PID. But that was just a single terminal window, so maybe the _windowsXamlManager = xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread call on the Main thread is also creating a separate CoreWindow...

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Apr 13, 2023
@DHowett
Copy link
Member

DHowett commented Apr 13, 2023

Wait, do we need xaml on the emp thread?

@zadjii-msft zadjii-msft requested a review from lhecker April 13, 2023 16:10
@zadjii-msft zadjii-msft marked this pull request as ready for review April 13, 2023 16:10
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@j4james would you be able to test this on W10 using Mike's unpackaged CI build artifacts? (We can probably also test it ourselves, I admit)

@zadjii-msft
Copy link
Member Author

Actually tested this on Windows 10 in a VM too.

For future self:

Add-AppxPackage -Path path\to\Appx\AppxManifest.xml -register

will register the dev appx for testing. You need to enable dev mode first. You need to actually do that too, so that it'll hook up the MUX 2.8 FWP dependency. (you could do the whole unpackaged thing too, but I haven't gotten far enough to bother with that yet)

@j4james
Copy link
Collaborator

j4james commented Apr 13, 2023

I've just tested with these changes patched into my dev build, and it's definitely fixed the issue for me.

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K, let's go then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ghost/dummy window appears in the task bar (DesktopWindowXamlSource)
4 participants