WindowsVirtualDesktopHelper icon indicating copy to clipboard operation
WindowsVirtualDesktopHelper copied to clipboard

[Bug]: WindowsVirtualDesktopHelper fighting native desktop switching

Open fredless opened this issue 10 months ago • 12 comments

What happened?

When I use native key combo's (i.e. CTRL+WIN+RIGHT\LEFT) to switch between virtual desktops, WindowsVirtualDesktopHelper seems to actively fight my switching. Using a single 4K monitor and 7 virtual desktops.

2 different but similar behaviors observed:

  1. sometimes when switching to an adjacent desktop (i.e. going from desktop #3 to #2 or #4), the desktop will immediately switch back to #3 - this seems to happen reliably after resuming from sleep or hibernate states, but also pops up randomly at other times too. once it starts, it becomes reproducible every time. if I restart WVDH after I see this, the problem will go away... for a while
  2. when I switch desktops rapidly via multiple rapid keypress (i.e. I'm on desktop #2 and want to be on #7, so I hold CTRL+WIN and RIGHT 5 times in rapid succession), the resulting desktop switching becomes very erratic (i.e. I see it go #3, #4, #3, #2, #3) and I often don't end up where I expected - this happens all the time, very reproducible

As soon as I quit WVDH, these problems disappear, so clearly contributing. I would think that we would be monitoring but not trying to enforce a desktop selection when a switch is conducted via other methods, but this does not appear to be the case.

WVDH Version

2.0

Windows Version

23H2 build 23635.4805

Relevant log output


fredless avatar Feb 05 '25 19:02 fredless

I also tried toggling off most of the optional settings in the event that modified the problem behavior, but it didn't seem to make any difference.

fredless avatar Feb 05 '25 19:02 fredless

Hi, I had similar problems, I guess something has changed in the handling of Accent Color. Note that I also had issues after disabling WindowVirtualDesktopHelper. Setting it to manual as explained here solved the issue for me. Hope this helps

sysopmd avatar Feb 13 '25 16:02 sysopmd

Hi, I had similar problems, I guess something has changed in the handling of Accent Color. Note that I also had issues after disabling WindowVirtualDesktopHelper. Setting it to manual as explained here solved the issue for me.

Thanks for the reply @sysopmd - because I dislike that feature so I already had all the accent color options disabled as described in the article - but still an interesting read.

I was noticing something else though: even when not running WindowVirtualDesktopHelper and just using normal WIN+RIGHT/LEFT shortcuts to change desktop, there was no "fighting" but the desktop backgrounds were taking a noticeable amount of time to also change from the previous desktop's value. Sub-second, but not by much - a very noticeable amount of lag there. I usually run 1 but sometimes 2 4K-resolution monitors, each with a different image.

So I set all the desktops to the same image (easy via right-clicking an image Settings.. Personalization... Background.. Recent Image..), and at first glance the problem behavior I was experiencing with WindowsVirtualDesktopHelper immediately disappeared. Will keep an eye out for it and update my experience in a week.

Note there are also some posts here and there that suggest not using images of a different size\aspect ratio and relying on Fill. I have not tried this yet (and my desktop images are indeed all of a differing variety here) but if I get a few days of acceptable experience using a single desktop image, that will be the next test.

fredless avatar Feb 18 '25 14:02 fredless

UPDATE: good behavior didn't last long, the fighting as described in my OP recurred - it's now just fighting/flipping much faster with a single background image, but I'm still seeing essentially the same behavior when WVDH is running.

fredless avatar Feb 18 '25 14:02 fredless

Hi fredless,

Note there are also some posts here and there that suggest not using images of a different size\aspect ratio and relying on Fill. I have not tried this yet (and my desktop images are indeed all of a differing variety here) but if I get a few days of acceptable experience using a single desktop image, that will be the next test.

I also found similar posts and I had resized my wallpapers to the screen size actually, but forgot to mention this. It is still working fine for me, so it is worth giving it a shot.

sysopmd avatar Feb 18 '25 15:02 sysopmd

Hi @fredless @sysopmd , Thanks for looking into this and researching. I've seen this happen as well, but my observations are more leaning into that there is something going on with Windows focusing of apps. I notice it more that an application is somehow re-grabbing the focus. Does your log have any exceptions? That would be helpful. Thanks! -dan

dankrusi avatar Feb 19 '25 09:02 dankrusi

how do we log? happy to replicate and watch.

also, worth pointing also out that the behavior does stop when I quit WVDH.

fredless avatar Feb 19 '25 18:02 fredless

Go to About > Show Log. Thnx

dankrusi avatar Feb 24 '25 09:02 dankrusi

@dankrusi, log - taken directly after reproducing the behaviors:

Using config file(s):

   C:\Users\xxx\AppData\Roaming\WindowsVirtualDesktopHelper\WindowsVirtualDesktopHelper.exe.config
Config: 

   feature.showDesktopSwitchOverlay: false
   feature.showPrevNextIcons: false
   feature.useHotKeyToJumpToDesktopNumber: false
   feature.showDesktopNumberInIconTray.clickToOpenTaskView: false
   feature.showDesktopSwitchOverlay.animate: false
   feature.showDesktopSwitchOverlay.showOnAllMonitors: false
   feature.showDesktopSwitchOverlay.translucent: false
   feature.useHotKeyToJumpToDesktopNumber.hotkey: "Ctrl"
   general.startupWithWindows: true
GetImplementationForOS: Windows Build Version: 26120.3360
GetImplementationForOS: Detected Windows 11 Insider Canary 25314 due to build >= 25314
LoadImplementationWithFallback: trying to load implementation VirtualDesktopWin11_Insider25314
LoadImplementation: Loading VDImplementation: VirtualDesktopWin11_Insider25314...
LoadImplementationWithFallback: failed to load VirtualDesktopWin11_Insider25314: System.Exception: LoadImplementation: could not load VirtualDesktop API implementation VirtualDesktopWin11_Insider25314: The type initializer for 'DesktopManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DesktopManager' threw an exception. ---> System.InvalidCastException: Specified cast is not valid.

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider25314.IServiceProvider10.QueryService(Guid& service, Guid& riid)

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider25314.DesktopManager..cctor()

   --- End of inner exception stack trace ---

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider25314.Current()
   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name)

   --- End of inner exception stack trace ---

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name)
   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementationWithFallback(String name)
LoadImplementationWithFallback: trying to load implementation VirtualDesktopWin11_Insider22631
LoadImplementation: Loading VDImplementation: VirtualDesktopWin11_Insider22631...
LoadImplementationWithFallback: failed to load VirtualDesktopWin11_Insider22631: System.Exception: LoadImplementation: could not load VirtualDesktop API implementation VirtualDesktopWin11_Insider22631: The type initializer for 'DesktopManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DesktopManager' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider22631.IServiceProvider10.QueryService(Guid& service, Guid& riid)

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider22631.DesktopManager..cctor()

   --- End of inner exception stack trace ---

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider22631.Current()
   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name)

   --- End of inner exception stack trace ---

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name)
   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementationWithFallback(String name)

LoadImplementationWithFallback: trying to load implementation VirtualDesktopWin11_Insider
LoadImplementation: Loading VDImplementation: VirtualDesktopWin11_Insider...
LoadImplementationWithFallback: failed to load VirtualDesktopWin11_Insider: System.Exception: LoadImplementation: could not load VirtualDesktop API implementation VirtualDesktopWin11_Insider: The type initializer for 'DesktopManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DesktopManager' threw an exception. ---> System.InvalidCastException: Specified cast is not valid.

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider.IServiceProvider10.QueryService(Guid& service, Guid& riid)

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider.DesktopManager..cctor()

   --- End of inner exception stack trace ---

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider.Current()

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name)

   --- End of inner exception stack trace ---

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name)

   at WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementationWithFallback(String name)
LoadImplementationWithFallback: trying to load implementation VirtualDesktopWin11_23H2_2921
LoadImplementation: Loading VDImplementation: VirtualDesktopWin11_23H2_2921...
LoadImplementationWithFallback: success!

fredless avatar Mar 06 '25 01:03 fredless

I re-enabled Accent colors and noticed slow switching time. Then I took this log.

Using config file: C:\Program Files (x86)\Windows Virtual Desktop Helper\WindowsVirtualDesktopHelper.exe.config GetImplementationForOS: Windows Build Version: 26100.3194 GetImplementationForOS: Detected Windows 11 Insider Canary 25314 due to build >= 25314 LoadImplementationWithFallback: trying to load implementation VirtualDesktopWin11_Insider25314 LoadImplementation: Loading VDImplementation: VirtualDesktopWin11_Insider25314... LoadImplementationWithFallback: failed to load VirtualDesktopWin11_Insider25314: System.Exception: LoadImplementation: could not load VirtualDesktop API implementation VirtualDesktopWin11_Insider25314: L'inizializzatore di tipo di 'DesktopManager' ha generato un'eccezione. ---> System.TypeInitializationException: L'inizializzatore di tipo di 'DesktopManager' ha generato un'eccezione. ---> System.InvalidCastException: Cast specificato non valido. in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider25314.IServiceProvider10.QueryService(Guid& service, Guid& riid) in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider25314.DesktopManager..cctor() --- Fine della traccia dello stack dell'eccezione interna --- in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider25314.Current() in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name) --- Fine della traccia dello stack dell'eccezione interna --- in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name) in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementationWithFallback(String name) LoadImplementationWithFallback: trying to load implementation VirtualDesktopWin11_Insider22631 LoadImplementation: Loading VDImplementation: VirtualDesktopWin11_Insider22631... LoadImplementationWithFallback: failed to load VirtualDesktopWin11_Insider22631: System.Exception: LoadImplementation: could not load VirtualDesktop API implementation VirtualDesktopWin11_Insider22631: L'inizializzatore di tipo di 'DesktopManager' ha generato un'eccezione. ---> System.TypeInitializationException: L'inizializzatore di tipo di 'DesktopManager' ha generato un'eccezione. ---> System.NotImplementedException: Operazione o metodo non implementato. in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider22631.IServiceProvider10.QueryService(Guid& service, Guid& riid) in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider22631.DesktopManager..cctor() --- Fine della traccia dello stack dell'eccezione interna --- in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider22631.Current() in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name) --- Fine della traccia dello stack dell'eccezione interna --- in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name) in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementationWithFallback(String name) LoadImplementationWithFallback: trying to load implementation VirtualDesktopWin11_Insider LoadImplementation: Loading VDImplementation: VirtualDesktopWin11_Insider... LoadImplementationWithFallback: failed to load VirtualDesktopWin11_Insider: System.Exception: LoadImplementation: could not load VirtualDesktop API implementation VirtualDesktopWin11_Insider: L'inizializzatore di tipo di 'DesktopManager' ha generato un'eccezione. ---> System.TypeInitializationException: L'inizializzatore di tipo di 'DesktopManager' ha generato un'eccezione. ---> System.InvalidCastException: Cast specificato non valido. in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider.IServiceProvider10.QueryService(Guid& service, Guid& riid) in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider.DesktopManager..cctor() --- Fine della traccia dello stack dell'eccezione interna --- in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Implementation.VirtualDesktopWin11_Insider.Current() in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name) --- Fine della traccia dello stack dell'eccezione interna --- in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementation(String name) in WindowsVirtualDesktopHelper.VirtualDesktopAPI.Loader.LoadImplementationWithFallback(String name) LoadImplementationWithFallback: trying to load implementation VirtualDesktopWin11_23H2_2921 LoadImplementation: Loading VDImplementation: VirtualDesktopWin11_23H2_2921... LoadImplementationWithFallback: success!

Then I disabled Accent Colors, exited WVDH and relaunched it, same log for me (identical diff). So I guess that what I am seeing now is just related to Accent Colors feature and not to WVDH. I was having the behavior of something 'fighting against my desktop switch' in the past, but cannot repro right now. I'll see if I can try with wallpapers of different size later.

sysopmd avatar Mar 06 '25 08:03 sysopmd

@dankrusi, @fredless Sorry guys, it is a "can't repro" on my side. Even using a picture with rescaling I can't see the behavior I saw previously. Log seems ok.

sysopmd avatar Mar 11 '25 10:03 sysopmd

I'll comment here, even though the behavior is slightly different for me. I don't use the native shortcuts at all, only ALT + 2,3,4 provided by WVDH. But the behavior is like described, sometimes the desktop immediately switches back to the previous one. I need several attempts to finally do the switch. It seems to help when I focus different stuff, like the Taskbar. It's really quite annoying, but I can't provide a step-by-step list how to reproduce the issue. It seems to happen randomly and seems to get worse and worse each Windows session.

freijon avatar Aug 25 '25 06:08 freijon