diff --git a/Components/VirtualDesktopManager.cs b/Components/VirtualDesktopManager.cs index c29967d..a784531 100644 --- a/Components/VirtualDesktopManager.cs +++ b/Components/VirtualDesktopManager.cs @@ -36,10 +36,19 @@ private static void Init() private static void InitializeVirtualDesktopManagerInternal(IServiceProvider10? shell) { - if (Environment.OSVersion.Version.Build >= 22631) - VirtualDesktopManagerInternal = (IVirtualDesktopManagerInternal?)shell?.QueryService( - Guids.CLSID_VirtualDesktopManagerInternal, - typeof(IVirtualDesktopManagerInternal).GUID); + try + { + if (Environment.OSVersion.Version.Build >= 22631) + VirtualDesktopManagerInternal = (IVirtualDesktopManagerInternal?)shell?.QueryService( + Guids.CLSID_VirtualDesktopManagerInternal, + typeof(IVirtualDesktopManagerInternal).GUID); + } + catch (Exception e) + { + Main.Context.API.LogException($"Flow.Plugin.WindowWalker.{VirtualDesktopManager}", + "Unable to load VirtualDesktopManagerInternal", e); + VirtualDesktopManagerInternal = null; + } } internal static IApplicationView GetApplicationView(this IntPtr hWnd)