SubtitleEdit/subtitleedit · critical · PlatformNotSupportedException
Unsupported OS platform.
Error message
Unsupported OS platform.
What it means
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.
Source
Thrown at src/ui/Logic/VideoPlayers/LibVlcDynamic/LibVlcDynamicPlayer.cs:263
}
private static string[] GetLibraryNames()
{
if (OperatingSystem.IsWindows())
{
return ["libvlc.dll"];
}
else if (OperatingSystem.IsLinux())
{
return ["libvlc.so"];
}
else if (OperatingSystem.IsMacOS())
{
return ["libvlc.dylib"];
}
else
{
throw new PlatformNotSupportedException("Unsupported OS platform.");
}
}
private static string[] GetLibraryPaths()
{
if (OperatingSystem.IsWindows())
{
return
[
LibVlcPath,
Directory.GetCurrentDirectory(),
Path.Combine(Directory.GetCurrentDirectory(), "VLC"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "VideoLAN", "VLC"),
string.Empty,
];
}
else if (OperatingSystem.IsLinux())
{View on GitHub (pinned to 17a9f07487)
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.
Example fix
// before: constructs the VLC player unconditionally
var player = new LibVlcDynamicPlayer();
player.LoadLib();
// after: gate construction on a supported platform
if (!OperatingSystem.IsWindows() && !OperatingSystem.IsLinux() && !OperatingSystem.IsMacOS())
{
throw new PlatformNotSupportedException("LibVLC player requires Windows, Linux, or macOS.");
}
var player = new LibVlcDynamicPlayer();
player.LoadLib(); Defensive patterns
Strategy: validation
Validate before calling
// Never construct the VLC player on an OS it cannot load from.
public static bool IsLibVlcSupported() =>
OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS();
if (!IsLibVlcSupported())
{
return SelectNonVlcPlayer();
}
var player = new LibVlcDynamicPlayer(); Prevention
- 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.
When it happens
Trigger: 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().
Common situations: 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.
Related errors
- Failed to initialize VLC
- Unsupported Windows architecture.
- LibVLC download is not supported on this platform
- Operation is not supported on this platform.
- PaddleOCR is not available for Linux ARM64.
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/982962ccea54a4f1.
Report an issue: GitHub.