{"record":{"id":"982962ccea54a4f1","repo":"SubtitleEdit/subtitleedit","slug":"unsupported-os-platform-982962","errorCode":null,"errorMessage":"Unsupported OS platform.","messagePattern":"Unsupported OS platform\\.","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"critical","filePath":"src/ui/Logic/VideoPlayers/LibVlcDynamic/LibVlcDynamicPlayer.cs","lineNumber":263,"sourceCode":"    }\n\n    private static string[] GetLibraryNames()\n    {\n        if (OperatingSystem.IsWindows())\n        {\n            return [\"libvlc.dll\"];\n        }\n        else if (OperatingSystem.IsLinux())\n        {\n            return [\"libvlc.so\"];\n        }\n        else if (OperatingSystem.IsMacOS())\n        {\n            return [\"libvlc.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                LibVlcPath,\n                Directory.GetCurrentDirectory(),\n                Path.Combine(Directory.GetCurrentDirectory(), \"VLC\"),\n                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), \"VideoLAN\", \"VLC\"),\n                string.Empty,\n            ];\n        }\n        else if (OperatingSystem.IsLinux())\n        {","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/VideoPlayers/LibVlcDynamic/LibVlcDynamicPlayer.cs#L245-L281","documentation":"Thrown by the terminal 'else' branch of GetLibraryNames() after the OperatingSystem checks for Windows, Linux, and macOS all returned false. It is a PlatformNotSupportedException guarding the list of candidate native library filenames (libvlc.dll / libvlc.so / libvlc.dylib). The dynamic loader has no filename to search for on any other OS, so it refuses up front rather than silently loading nothing.","triggerScenarios":"The LibVlcDynamicPlayer is constructed and any method that needs the native library (LoadLib / CanLoad / Initialize) is invoked while running on an OS that is not Windows, Linux, or macOS — e.g. FreeBSD, Solaris, or a generic Unix not reported by OperatingSystem.IsLinux(). GetLibraryNames() is called first inside LoadLibraryInternal().","commonSituations":"Running the app under .NET on FreeBSD or another Unix flavor where OperatingSystem.IsLinux() returns false; a build/runtime where the OS detection helpers are not calibrated; unit tests executed on an unusual CI image. Not reachable on the three supported platforms because their branch returns before this else.","solutions":["Run Subtitle Edit on a supported platform (Windows, Linux, or macOS) — this player is gated to those three.","If you must support another Unix, extend GetLibraryNames() with an additional OperatingSystem guard returning the correct SONAME before recompiling.","Select a different IVideoPlayer implementation on unsupported platforms instead of constructing LibVlcDynamicPlayer.","Wrap player selection in an OS capability check so LibVlcDynamicPlayer is never instantiated on an unsupported OS."],"exampleFix":"// before: constructs the VLC player unconditionally\nvar player = new LibVlcDynamicPlayer();\nplayer.LoadLib();\n\n// after: gate construction on a supported platform\nif (!OperatingSystem.IsWindows() && !OperatingSystem.IsLinux() && !OperatingSystem.IsMacOS())\n{\n    throw new PlatformNotSupportedException(\"LibVLC player requires Windows, Linux, or macOS.\");\n}\nvar player = new LibVlcDynamicPlayer();\nplayer.LoadLib();","handlingStrategy":"validation","validationCode":"// Never construct the VLC player on an OS it cannot load from.\npublic static bool IsLibVlcSupported() =>\n    OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS();\n\nif (!IsLibVlcSupported())\n{\n    return SelectNonVlcPlayer();\n}\nvar player = new LibVlcDynamicPlayer();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate player construction on a single IsLibVlcSupported() helper kept in sync with GetLibraryNames/GetLibraryPaths so the unsupported-OS branches are unreachable.","Do not ship this player for platforms outside Windows/Linux/macOS in your target-framework matrix.","If extending to a new OS, add the branch to BOTH GetLibraryNames() and GetLibraryPaths() and update the helper together."],"tags":["platform","libvlc","video-player","os-detection","platformnotsupported"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}