{"record":{"id":"a9edf6fc2bc421f1","repo":"SubtitleEdit/subtitleedit","slug":"unsupported-os-platform-a9edf6","errorCode":null,"errorMessage":"Unsupported OS platform.","messagePattern":"Unsupported OS platform\\.","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"error","filePath":"src/ui/Logic/VideoPlayers/LibMpvDynamic/LibMpvDynamicPlayer.cs","lineNumber":237,"sourceCode":"    }\n\n    private static string[] GetLibraryNames()\n    {\n        if (OperatingSystem.IsWindows())\n        {\n            return [\"libmpv-2.dll\"];\n        }\n        else if (OperatingSystem.IsLinux())\n        {\n            return [\"libmpv.so.2\", \"libmpv.so\"];\n        }\n        else if (OperatingSystem.IsMacOS())\n        {\n            return [\"libmpv.dylib\", \"libmpv.2.dylib\"];\n        }\n        else\n        {\n            throw new PlatformNotSupportedException(\"Unsupported OS platform.\");\n        }\n    }\n\n    private static string[] GetLibraryPaths()\n    {\n        if (OperatingSystem.IsWindows())\n        {\n            return\n            [\n                MpvPath,\n                Directory.GetCurrentDirectory(),\n                string.Empty,\n            ];\n        }\n        else if (OperatingSystem.IsLinux())\n        {\n            return\n            [","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/VideoPlayers/LibMpvDynamic/LibMpvDynamicPlayer.cs#L219-L255","documentation":"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.","triggerScenarios":"Running on an OS where OperatingSystem.IsWindows/IsLinux/IsMacOS all return false (e.g. FreeBSD, Solaris), or an environment with misleading runtime platform flags.","commonSituations":"Deploying to an unsupported OS, or running inside a container whose platform flags do not match a supported RID.","solutions":["Run the application on a supported OS (Windows, Linux, or macOS).","If porting, add a branch returning the platform's libmpv soname and library paths.","Gate the video feature behind a platform check so unsupported OSes disable it cleanly."],"exampleFix":"// before\nvar names = LibMpvDynamicPlayer.GetLibraryNames();\n\n// after\nif (!(OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())) { DisableVideoFeature(); return; }\nvar names = LibMpvDynamicPlayer.GetLibraryNames();","handlingStrategy":"validation","validationCode":"if (!(OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())) { DisableVideoFeature(); return; }","typeGuard":null,"tryCatchPattern":"try { var names = LibMpvDynamicPlayer.GetLibraryNames(); }\ncatch (PlatformNotSupportedException) { DisableVideoFeature(); logger.LogWarning(\"Video playback unsupported on this OS\"); }","preventionTips":["Gate the video feature behind a supported-OS check in the UI.","Disable the feature cleanly on unsupported platforms.","When porting, add platform branches for filenames and paths."],"tags":["platform","mpv","runtime","unsupported"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}