Exception after fresh install of VirtualDesktop 1.18
neilkatin opened this issue · 7 comments
I tried running VirtualDesktop 1.18 today (downloaded from the github release folder). I get this error when I run it:
Downloads/VirtualDesktop11 /list
Unhandled Exception: System.TypeInitializationException: The type initializer for 'VirtualDesktop.DesktopManager' threw an exception. ---> System.InvalidCastException: Specified cast is not valid.
at VirtualDesktop.IServiceProvider10.QueryService(Guid& service, Guid& riid)
at VirtualDesktop.DesktopManager..cctor()
--- End of inner exception stack trace ---
at VDeskTool.Program.Main(String[] args)
I tried both VirtualDesktop11 and VirtualDesktop11-24H2 (I don't think I'm running the win11-24h2 patch, but I wanted to see if it made a difference).
I apologize in advance if this is a RTFM issue.
Just for background info: PSVirtualDesktop also didn't work, so there may be an issue with my machine relative to VirtualDesktop assumptions.
Hello @neilkatin,
sorry this does not work. Can you please post the Windows version you're using (as seen with Winver.exe) and the Powershell version (just execute $PSVersionTable and post the PSVersion).
Greetings
Markus
Hi Markus.
Windows 11, V21H2 OS Build 22000.2538
Powershell 7.4.3
I could reproduce this issue and get the same error message on: 22000.2538,
the IID for this version should be: b2f925b9-5a0f-4d2e-9f4d-2b1507593c10
VirtualDesktop21H2.cs would work
https://github.com/MScholtes/VirtualDesktop/releases/download/V1.16/VirtualDesktop11-21H2.exe
https://github.com/MScholtes/VirtualDesktop/releases/tag/V1.16
I did: git grep b2f925b9-5a0f-4d2e-9f4d-2b1507593c10 $(git rev-list --all)
added:
66d1bbc
deleted:
b2ba5a3
___
I also see that IID 4970ba3d-fd4e-4647-bea3-d89076ef4b9c
is missing from any of the commits
;from 22621.2215
IID_IVirtualDesktopManagerInternal:="{4970ba3d-fd4e-4647-bea3-d89076ef4b9c}"
IID_IVirtualDesktop:="{a3175f2d-239c-4bd2-8aa0-eeba8b0b138e}"
IID_IVirtualDesktopNotification:="{b287fa1c-7771-471a-a2df-9b6b21f0d675}"
idx_MoveViewToDesktop:=4 ;DllCall(ptr_MoveViewToDesktop,"Ptr",IVirtualDesktopManagerInternal,"Ptr",IApplicationView,"Ptr",IVirtualDesktop)
idx_GetCurrentDesktop:=6 ;DllCall(ptr_GetCurrentDesktop,"Ptr",IVirtualDesktopManagerInternal,"Ptr*",&IVirtualDesktop:=0)
idx_GetDesktops:=7 ;DllCall(ptr_GetDesktops,"Ptr",IVirtualDesktopManagerInternal,"Ptr*",&IObjectArray:=0)
idx_SwitchDesktop:=9 ;DllCall(ptr_SwitchDesktop,"Ptr",IVirtualDesktopManagerInternal,"Ptr",IVirtualDesktop)
idx_CreateDesktop:=10 ;DllCall(ptr_CreateDesktop,"Ptr",IVirtualDesktopManagerInternal,"Ptr*",&IVirtualDesktop:=0)
idx_RemoveDesktop:=12 ;DllCall(ptr_RemoveDesktop,"Ptr",IVirtualDesktopManagerInternal,"Ptr",IVirtualDesktop,"Ptr",IVirtualDesktop_fallback)
idx_SwitchDesktopWithAnimation:=21 ;DllCall(ptr_SwitchDesktopWithAnimation,"Ptr",IVirtualDesktopManagerInternal,"Ptr",IVirtualDesktop)
idx_GetId:=4 ;DllCall(ptr_GetId,"Ptr",IVirtualDesktop,"Ptr",guid_buf)
idx_VirtualDesktopNameChanged:=8 ;params (IVirtualDesktop, HSTRING)
idx_SetDesktopName:=15 ;DllCall(ptr_SetDesktopName,"Ptr",IVirtualDesktopManagerInternal,"Ptr",IVirtualDesktop,"Ptr",HSTRING)
idx_GetName:=5 ;DllCall(ptr_GetName,"Ptr",IVirtualDesktop,"Ptr*",HSTRING)
idx_VirtualDesktopWallpaperChanged:=11 ;params (IVirtualDesktop, HSTRING)
idx_SetDesktopWallpaper:=16 ;DllCall(ptr_SetDesktopWallpaper,"Ptr",IVirtualDesktopManagerInternal,"Ptr",IVirtualDesktop,"Ptr",HSTRING)
idx_GetWallpaper:=6 ;DllCall(ptr_GetWallpaper,"Ptr",IVirtualDesktop,"Ptr*",HSTRING)
idx_VirtualDesktopCreated:=3 ;params (IVirtualDesktop)
idx_VirtualDesktopDestroyBegin:=4 ;params (IVirtualDesktop, IVirtualDesktop_fallback)
idx_VirtualDesktopDestroyFailed:=5 ;params (IVirtualDesktop, IVirtualDesktop_fallback)
idx_VirtualDesktopDestroyed:=6 ;params (IVirtualDesktop, IVirtualDesktop_fallback)
idx_ViewVirtualDesktopChanged:=9 ;params (IApplicationView)
idx_CurrentVirtualDesktopChanged:=10 ;params (IVirtualDesktop_old, IVirtualDesktop_new)
IVirtualDesktopNotification.methods_count:=14
refer to https://github.com/FuPeiJiang/Windows-BuildNumber-VirtualDesktop/blob/main/byVersion.txt for which IID and which
method indexes are used for each windows build version range
the README.md offers a more simplified view: https://github.com/FuPeiJiang/Windows-BuildNumber-VirtualDesktop/blob/main/README.md
since the binary VirtualDesktop11.exe
is only 65kb, you could do an all-in-one version using if statements and it'd still be small
VirtualDesktop-All.exe
?
Hello @neilkatin,
I apologise for the late reply, I was on holiday.
Windows 11 21H2 is out of support (https://learn.microsoft.com/en-gb/lifecycle/announcements/windows-11-21h2-end-of-servicing), so I removed the code for this version from VirtualDesktop. Please update.
@FuPeiJiang: I make an all-in-one-version in the compagion repository PSVirtualDesktop (https://github.com/MScholtes/PSVirtualDesktop), it is much more effort to maintain.
Greetings
Markus
Hello @neilkatin,
I apologise for the late reply, I was on holiday.
Windows 11 21H2 is out of support (https://learn.microsoft.com/en-gb/lifecycle/announcements/windows-11-21h2-end-of-servicing), so I removed the code for this version from VirtualDesktop. Please update.
@FuPeiJiang: I make an all-in-one-version in the compagion repository PSVirtualDesktop (https://github.com/MScholtes/PSVirtualDesktop), it is much more effort to maintain.
Greetings
Markus
First of all: no need at all to apologize for having a life apart from this project; I appreciate
you making it available at all.
Unfortunately my machine running win11 21h1 died, I spun up a new machine running 23h2 and the 1.18 release works fine, as you expected.
I assume that the issue no longer exists as there is no feedback.