{"record":{"id":"fa6dbdb7fad8c86a","repo":"d2phap/ImageGlass","slug":"ige-this-feature-is-not-supported-on-macos","errorCode":null,"errorMessage":"IGE: This feature is not supported on macOS.","messagePattern":"IGE: This feature is not supported on macOS\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"warning","filePath":"source/ImageGlass.Mac/Common/ServiceProviders/MacShellProvider.cs","lineNumber":177,"sourceCode":"        if (string.IsNullOrWhiteSpace(dirPath)) return;\n\n        try\n        {\n            Directory.CreateDirectory(dirPath);\n        }\n        catch { }\n\n        BHelper.RunProcess(\"open\", $\"\\\"{dirPath}\\\"\");\n    }\n\n\n    /// <summary>\n    /// <inheritdoc/>\n    /// </summary>\n    /// <exception cref=\"NotSupportedException\"></exception>\n    public Task<DefaultAppScope?> SetDefaultPhotoViewerAsync(string[] extensions, bool enable)\n    {\n        throw new NotSupportedException(\"IGE: This feature is not supported on macOS.\");\n    }\n\n\n    /// <summary>\n    /// <inheritdoc/>\n    /// </summary>\n    public Task SetLockScreenAsync(string filePath)\n    {\n        throw new NotSupportedException(\"IGE: This feature is not supported on macOS.\");\n    }\n\n\n    /// <summary>\n    /// <inheritdoc/>\n    /// </summary>\n    public void SetWallpaper(string filePath)\n    {\n        // use AppleScript via System Events (works on macOS Ventura+)","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/d2phap/ImageGlass/blob/4a3c4feceffc5a8bb5e56ba836509634aaae47a9/source/ImageGlass.Mac/Common/ServiceProviders/MacShellProvider.cs#L159-L195","documentation":"Thrown by MacShellProvider.SetDefaultPhotoViewerAsync. Unlike Windows (which can write the registry / Default Apps associations) there is no supported public macOS API to programmatically register an app as the default handler for a set of file extensions; macOS requires the user to confirm via System Settings. ImageGlass therefore hard-rejects the operation on macOS with NotSupportedException. The method is part of the IShellProvider contract and returns Task<DefaultAppScope?>, but on Mac it never produces a scope.","triggerScenarios":"Invoking the 'Set as default photo viewer' command or calling Core.ShellProvider.SetDefaultPhotoViewerAsync(extensions, enable) on the ImageGlass.Mac build. Any plugin or settings flow that assumes default-app registration works cross-platform.","commonSituations":"A settings page exposes the 'default photo viewer' toggle without hiding it on macOS; porting the Windows default-app flow and assuming every IShellProvider implements it; an automation/script calling the API on Mac.","solutions":["Hide the 'Set as default photo viewer' UI on macOS via XAML OnPlatform or OperatingSystem.IsMacOS() so the call is never issued.","Introduce a capability property on IShellProvider (e.g. SupportsDefaultPhotoViewer) that returns false on Mac and branch on it.","If macOS support is required, implement a fallback that opens System Settings > Desktop & Dock / the relevant pane and instructs the user to set the association manually, instead of throwing.","At minimum, catch NotSupportedException at the call site and show an informational message instead of crashing."],"exampleFix":"// before\nawait Core.ShellProvider.SetDefaultPhotoViewerAsync(exts, enable: true);\n\n// after\nif (!OperatingSystem.IsMacOS())\n{\n    await Core.ShellProvider.SetDefaultPhotoViewerAsync(exts, enable: true);\n}","handlingStrategy":"validation","validationCode":"// macOS has no public API to set the default photo viewer.\nif (!OperatingSystem.IsMacOS())\n{\n    _ = Core.ShellProvider.SetDefaultPhotoViewerAsync(exts, enable: true);\n}","typeGuard":"// Capability gate:\n// bool SupportsDefaultPhotoViewer => !OperatingSystem.IsMacOS();\nif (Core.ShellProvider is { SupportsDefaultPhotoViewer: true } shell)\n    await shell.SetDefaultPhotoViewerAsync(exts, enable: true);","tryCatchPattern":"try { await Core.ShellProvider.SetDefaultPhotoViewerAsync(exts, true); }\ncatch (NotSupportedException) when (OperatingSystem.IsMacOS())\n{ /* expected on macOS */ }","preventionTips":["Hide the 'Set as default photo viewer' toggle on macOS in XAML.","Add a SupportsDefaultPhotoViewer capability rather than relying on exceptions.","Document that macOS default-app registration requires manual user action in System Settings."],"tags":["macos","platform-unsupported","default-app","shell","notsupportedexception","imageglass"],"backgroundTag":null,"analyzedSha":"4a3c4feceffc5a8bb5e56ba836509634aaae47a9","analyzedAt":"2026-08-13T16:58:15.523Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}