SubtitleEdit/subtitleedit · error · PlatformNotSupportedException

Unsupported OS platform.

Error message

Unsupported OS platform.

What it means

PlatformNotSupportedException from GetLibraryNames: while enumerating candidate libmpv native filenames, the runtime is neither Windows, Linux, nor macOS, so no filename candidates exist and libmpv cannot be loaded.

Source

Thrown at src/ui/Logic/VideoPlayers/LibMpvDynamic/LibMpvDynamicPlayer.cs:237

    }

    private static string[] GetLibraryNames()
    {
        if (OperatingSystem.IsWindows())
        {
            return ["libmpv-2.dll"];
        }
        else if (OperatingSystem.IsLinux())
        {
            return ["libmpv.so.2", "libmpv.so"];
        }
        else if (OperatingSystem.IsMacOS())
        {
            return ["libmpv.dylib", "libmpv.2.dylib"];
        }
        else
        {
            throw new PlatformNotSupportedException("Unsupported OS platform.");
        }
    }

    private static string[] GetLibraryPaths()
    {
        if (OperatingSystem.IsWindows())
        {
            return
            [
                MpvPath,
                Directory.GetCurrentDirectory(),
                string.Empty,
            ];
        }
        else if (OperatingSystem.IsLinux())
        {
            return
            [

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Run the application on a supported OS (Windows, Linux, or macOS).
  2. If porting, add a branch returning the platform's libmpv soname and library paths.
  3. Gate the video feature behind a platform check so unsupported OSes disable it cleanly.

Example fix

// before
var names = LibMpvDynamicPlayer.GetLibraryNames();

// after
if (!(OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())) { DisableVideoFeature(); return; }
var names = LibMpvDynamicPlayer.GetLibraryNames();
Defensive patterns

Strategy: validation

Validate before calling

if (!(OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())) { DisableVideoFeature(); return; }

Try / catch

try { var names = LibMpvDynamicPlayer.GetLibraryNames(); }
catch (PlatformNotSupportedException) { DisableVideoFeature(); logger.LogWarning("Video playback unsupported on this OS"); }

Prevention

When it happens

Trigger: Running on an OS where OperatingSystem.IsWindows/IsLinux/IsMacOS all return false (e.g. FreeBSD, Solaris), or an environment with misleading runtime platform flags.

Common situations: Deploying to an unsupported OS, or running inside a container whose platform flags do not match a supported RID.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/a9edf6fc2bc421f1. Report an issue: GitHub.