d2phap/ImageGlass · error · NotSupportedException

IGE: This feature is not supported on {BHelper.OS}.

Error message

IGE: This feature is not supported on {BHelper.OS}.

What it means

Thrown by AppAPIProvider.IG_OpenWithAsync when BHelper.OS is not Windows. The feature uses the Windows shell 'Open With' dialog (Core.ShellProvider.ShowOpenWith), which has no equivalent on Linux or macOS in this build.

Source

Thrown at source/ImageGlass.Lib/Common/ServiceProviders/AppAPIs/AppAPIProvider.cs:572

        // 3. export frames
        Core.IsBusy = true;

        var exportWindow = new ExportFramesWindow(srcFilePath, destDirPath);
        await exportWindow.ShowAsync(App.MainWindow);

        Core.IsBusy = false;
    }


    /// <summary>
    /// Shows Open With window.
    /// </summary>
    public static async Task IG_OpenWithAsync()
    {
        if (BHelper.OS != OSType.Windows)
        {
            throw new NotSupportedException($"IGE: This feature is not supported on {BHelper.OS}.");
        }


        string? filePath = null;
        var isClipboardPhoto = Core.ClipboardImage is not null;


        if (isClipboardPhoto)
        {
            _ = Message.ShowAsync(Core.Lang[LangId._CreatingFile], delayMs: 500);

            // save clipboard photo as temp PNG file
            filePath = await Core.SavePhotoAsTempFileAsync();
        }
        else
        {
            filePath = Core.Photos.CurrentFilePath;
        }

View on GitHub (pinned to 4a3c4fecef)

Solutions

  1. Gate the call on BHelper.OS == OSType.Windows (or OperatingSystem.IsWindows()) before invoking.
  2. Hide the UI entry on non-Windows via the OnPlatform XAML markup extension on IsVisible.
  3. On non-Windows, open the containing folder or the system default app as a fallback instead of 'Open With'.

Example fix

// before
await AppAPIProvider.IG_OpenWithAsync();

// after
if (BHelper.OS == OSType.Windows)
{
    await AppAPIProvider.IG_OpenWithAsync();
}
Defensive patterns

Strategy: validation

Validate before calling

if (BHelper.OS != OSType.Windows) return; // or OperatingSystem.IsWindows()

Type guard

static bool CanOpenWith() => BHelper.OS == OSType.Windows;

Try / catch

try { await AppAPIProvider.IG_OpenWithAsync(); }
catch (NotSupportedException ex) when (ex.Message.Contains("not supported on"))
{ /* hide or disable the command on this platform */ }

Prevention

When it happens

Trigger: Invoking the IG_OpenWith action (menu item, hotkey, or API call) on Linux or macOS.

Common situations: Running the Linux or Mac build and the Open With command is still exposed in the UI or bound to a hotkey; a script calling the API regardless of platform.

Related errors


AI-assisted analysis of d2phap/ImageGlass@4a3c4fecef (2026-08-13). Data as JSON: /api/errors/8f6a25d5cd2faaf5. Report an issue: GitHub.