MScholtes / VirtualDesktop

C# command line tool to manage virtual desktops in Windows 10
MIT License
606 stars 60 forks source link

Exception with Windows Insider #20

Closed Grosner300 closed 3 years ago

Grosner300 commented 4 years ago

Using Windows Insider Windows 2004 OS Build 20257.1 Windows Feature Experience Pack 120.27509.10291.0 When running VirtualDesktop to move to a virtual desktop, exception is received: `+ ~~~~~~~~~~~~

In briefly reviewing the code it appears to be some missing GUIDs in this section: #region COM API internal static class Guids { public static readonly Guid CLSID_ImmersiveShell = new Guid("C2F03A33-21F5-47FA-B4BB-156362A2F239"); public static readonly Guid CLSID_VirtualDesktopManagerInternal = new Guid("C5E0CDCA-7B6E-41B2-9FC4-D93975CC467B"); public static readonly Guid CLSID_VirtualDesktopManager = new Guid("AA509086-5CA9-4C25-8F95-589D3C07B48A"); public static readonly Guid CLSID_VirtualDesktopPinnedApps = new Guid("B5A399E7-1C87-46B8-88E9-FC5747B171BD"); Hopefully, this can be fixed by replacing hard coded GUIDs with a GUID lookup to prevent this in the future.

MScholtes commented 4 years ago

Hello Gary,

there might be a change in the API with Windows Insider. When is the exception raised? At the start of the program or only when calling a disitinct function?

Greetings

Markus

Grosner300 commented 4 years ago

Markus Exception raised with the following call (from Powershell) to the dll (make Virtual Desktop 5 visible).

Add-Type -Path (Join-Path $PSScriptRoot "VirtualDesktop.dll") $currentDesktop = [VirtualDesktop.Desktop]::FromDesktop([VirtualDesktop.Desktop]::Current) [VirtualDesktop.Desktop]::FromIndex(4).MakeVisible();

Don't know if it matters or not, but 3 of the GUIDs included in my initial post do not appear in my Windows 10 registry.

MScholtes commented 4 years ago

Hello Gary,

does this error happen with my executable too?

Greetings

Markus

Grosner300 commented 3 years ago

Yes. After installing your ps1 cmdlet, I continue to receive exceptions in my Windows 10 Insider edition. See below. `PS C:\WINDOWS\system32> Get-DesktopList -?

NAME Get-DesktopList

SYNOPSIS Get list of virtual desktops

SYNTAX Get-DesktopList []

DESCRIPTION Get list of virtual desktops

RELATED LINKS https://github.com/MScholtes/PSVirtualDesktop https://github.com/MScholtes/TechNet-Gallery/tree/master/VirtualDesktop https://gallery.technet.microsoft.com/scriptcenter/Powershell-commands-to-d0e79cc5

REMARKS To see the examples, type: "get-help Get-DesktopList -examples". For more information, type: "get-help Get-DesktopList -detailed". For technical information, type: "get-help Get-DesktopList -full". For online help, type: "get-help Get-DesktopList -online"

PS C:\WINDOWS\system32> Get-DesktopList The type initializer for 'VirtualDesktop.DesktopManager' threw an exception. At C:\Program Files\WindowsPowerShell\Modules\VirtualDesktop\1.3.0\VirtualDesktop.ps1:839 char:15

PS C:\WINDOWS\system32>`

MScholtes commented 3 years ago

Hello Gary,

it seems that Microsoft has changed the API for virtual desktops again with the insider edition.

I do not have access to an insider edition so I have to wait for the release version (Microsoft will probably change the settings one more time).

Sorry for that

Markus

Grosner300 commented 3 years ago

ok. Thank you.

MScholtes commented 3 years ago

Closing the issue since there was no reply for over a month.