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

[PTRun][WindowWalker] Fails for computers where no Virtual Desktops have been created. #16896

Closed
1 task
jaimecbernardo opened this issue Mar 8, 2022 · 17 comments
Assignees
Labels
Issue-Bug Something isn't working Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@jaimecbernardo
Copy link
Collaborator

Microsoft PowerToys version

0.57.0-pre

Running as admin

  • Yes

Area(s) with issue?

PowerToys Run

Steps to reproduce

Start PowerToys Run in computers where no Virtual Desktops have been created yet, there's no registry key for the Virtual Desktops.
Window Walker is running into an error and not starting in these cases.
This is the current state building from main, likely after #16325

In order to simulate a PC that has never created Virtual desktops, remove these keys from the registry:

  • CurrentVirtualDesktop from \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\SessionInfo\1\VirtualDesktops
  • VirtualDesktopIDs from \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops

✔️ Expected Behavior

PowerToys Run starts normally.

❌ Actual Behavior

This message is shown:

image

This gets added to the PowerToys Run logs.

[2022-03-08 19:53:32.5499] [ERROR] [C:\a\_work\1\s\src\modules\launcher\Wox.Plugin\Common\VirtualDesktop\VirtualDesktopHelper.cs::104]
Failed to read the list of existing desktops form registry.

[2022-03-08 19:53:32.5712] [ERROR] [C:\a\_work\1\s\src\modules\launcher\Wox.Plugin\PluginPair.cs::177]
-------------------------- Begin exception --------------------------
Message: Can't create instance for <Window Walker> in C:\Program Files\PowerToys\modules\launcher\Plugins\WindowWalker\Microsoft.Plugin.WindowWalker.dll

Exception full name  : System.Reflection.TargetInvocationException
Exception message    : Exception has been thrown by the target of an invocation.
Exception stack trace:
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type)
   at Wox.Plugin.PluginPair.CreatePluginInstance()
Exception source     : System.Private.CoreLib
Exception target site: System.Object CreateInstanceDefaultCtor(Boolean, Boolean)
Exception HResult    : -2146232828

Exception full name  : System.TypeInitializationException
Exception message    : The type initializer for 'Microsoft.Plugin.WindowWalker.Main' threw an exception.
Exception stack trace:
   at Microsoft.Plugin.WindowWalker.Main..ctor()
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
Exception source     : Microsoft.Plugin.WindowWalker
Exception target site: Void .ctor()
Exception HResult    : -2146233036

Exception full name  : System.ArgumentOutOfRangeException
Exception message    : Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Exception stack trace:
   at Wox.Plugin.Common.VirtualDesktop.Helper.VirtualDesktopHelper.UpdateDesktopList()
   at Wox.Plugin.Common.VirtualDesktop.Helper.VirtualDesktopHelper..ctor(Boolean desktopListUpdate)
   at Microsoft.Plugin.WindowWalker.Main..cctor()
Exception source     : System.Private.CoreLib
Exception target site: Void ThrowArgumentOutOfRange_IndexException()
Exception HResult    : -2146233086
-------------------------- End exception --------------------------

Other Software

No response

@jaimecbernardo jaimecbernardo added Issue-Bug Something isn't working Product-PowerToys Run Improved app launch PT Run (Win+R) Window Priority-0 Bugs that we consider release-blocking/recall-class (P0) Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Mar 8, 2022
@jaimecbernardo
Copy link
Collaborator Author

@htcfreek , looks like we missed testing in some conditions ;)

@htcfreek
Copy link
Collaborator

htcfreek commented Mar 8, 2022

Good catch.

I am confused. Is this a special system or did you disabled Virtual Desktops? Based on my testing at least one desktop must exist.

Will look into this tomorrow. Please assign me.

@htcfreek
Copy link
Collaborator

htcfreek commented Mar 8, 2022

@jaimecbernardo
Can you please upload me the content of the registry values (especially VirtualDesktopIDs) on the machine?

Was this crash happening after or before showing the PT Run window?

@jaimecbernardo
Copy link
Collaborator Author

Thanks for picking it up.
It's a Windows 10 VM where no new Virtual Desktop has been created yet.
Those machines don't have those keys in registry.

In order to simulate a PC that has never created Virtual desktops, remove these keys from the registry:

  • CurrentVirtualDesktop from \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\SessionInfo\1\VirtualDesktops
  • VirtualDesktopIDs from \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops

@jaimecbernardo
Copy link
Collaborator Author

It's happening before showing the PT Run window.
It's when trying to load the plugins, I think.

@htcfreek
Copy link
Collaborator

htcfreek commented Mar 8, 2022

The question is what we return if this happens. "No desktop exist" or "desktop one" for each window? 🤔

@jaimecbernardo
Copy link
Collaborator Author

The question is what we return if this happens. "No desktop exist" or "desktop one" for each window? 🤔

Perhaps empty string for this case.

@htcfreek
Copy link
Collaborator

htcfreek commented Mar 9, 2022

The question is what we return if this happens. "No desktop exist" or "desktop one" for each window? 🤔

Perhaps empty string for this case.

Yes. This was an idea. It crashes when splitting the binary array from registry because the index that we calculate is invalid. So the idea is to set the desktop list to an empty one.

@htcfreek
Copy link
Collaborator

htcfreek commented Mar 9, 2022

@jaimecbernardo
Are you sure that the value VirtualDesktopIDs in \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops really doesn't exist? On my system the explorer crashes if I click on the desktop switcher symbol in task bar and the value is missing.

Or did you disabled virtual desktops with a gpo or something?

@jaimecbernardo
Copy link
Collaborator Author

Perhaps Windows 11 works differently than Windows 10. This is Windows 10.
image

@htcfreek
Copy link
Collaborator

htcfreek commented Mar 9, 2022

Perhaps Windows 11 works differently than Windows 10. This is Windows 10. image

I am on windows 10 too. Can you try what happens when you click on this bottun in your task bar:
image

@htcfreek
Copy link
Collaborator

htcfreek commented Mar 9, 2022

Perhaps Windows 11 works differently than Windows 10. This is Windows 10. image

I am on windows 10 too. Can you try what happens when you click on this bottun in your task bar: image

The crash on my system must be a race condition when clicking to fast and often on the button.

If I understand you correct, you don't use virtual desktops? So there isn't a condition where the key is missing unexpectedly?

@htcfreek htcfreek added Status-In progress This issue or work-item is under development and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Mar 10, 2022
@htcfreek
Copy link
Collaborator

htcfreek commented Mar 10, 2022

found a bug on win 11 too: The current desktopkey has moved:
image

@jaimecbernardo
Copy link
Collaborator Author

If I understand you correct, you don't use virtual desktops? So there isn't a condition where the key is missing unexpectedly?

This VM never used Virtual Desktops, so it's expected that the key is missing.

@htcfreek
Copy link
Collaborator

If I understand you correct, you don't use virtual desktops? So there isn't a condition where the key is missing unexpectedly?

This VM never used Virtual Desktops, so it's expected that the key is missing.

I have fond the crash reason and the fix is nearly ready. It crashes when trying to selecting desktop one from the empty desktop list. 😅 I will request your review in the PR.

@jaimecbernardo
Copy link
Collaborator Author

Sent a debug build that contained this 😅
The user configuration also ran into it. #16912 (comment)

@jaimecbernardo jaimecbernardo added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Mar 14, 2022
@htcfreek
Copy link
Collaborator

htcfreek commented Apr 2, 2022

This is fixed with 0.57.0. Please head over to https://aka.ms/installpowertoys

@htcfreek htcfreek closed this as completed Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Something isn't working Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

No branches or pull requests

2 participants