{"record":{"id":"df0b9dbf17c11836","repo":"SubtitleEdit/subtitleedit","slug":"unsupported-operating-system","errorCode":null,"errorMessage":"Unsupported operating system","messagePattern":"Unsupported operating system","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"error","filePath":"src/ui/Logic/Media/FileHelper.cs","lineNumber":764,"sourceCode":"                    {\n                        FileName = \"open\",\n                        Arguments = $\"\\\"{filePath}\\\"\",\n                        UseShellExecute = false\n                    });\n                }\n                else if (OperatingSystem.IsLinux())\n                {\n                    // Linux: use 'xdg-open' command\n                    Process.Start(new ProcessStartInfo\n                    {\n                        FileName = \"xdg-open\",\n                        Arguments = $\"\\\"{filePath}\\\"\",\n                        UseShellExecute = false\n                    });\n                }\n                else\n                {\n                    throw new PlatformNotSupportedException(\"Unsupported operating system\");\n                }\n            }\n            catch (Exception ex) when (ex is not FileNotFoundException && ex is not ArgumentException)\n            {\n                throw new InvalidOperationException($\"Failed to open file: {filePath}\", ex);\n            }\n        }\n    }\n}\n","sourceCodeStart":746,"sourceCodeEnd":774,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/Media/FileHelper.cs#L746-L774","documentation":"Thrown by OpenFileWithDefaultProgram when the OS is not Windows, macOS, or Linux. The method delegates to OS-specific openers (explorer/open/xdg-open) and has no opener for other systems, so it refuses with PlatformNotSupportedException before attempting a launch. This is the only path that reaches the final else branch.","triggerScenarios":"Calling OpenFileWithDefaultProgram on FreeBSD, Solaris, or any OS where OperatingSystem.IsWindows/IsMacOS/IsLinux all return false.","commonSituations":"Running SE under .NET on a niche Unix variant with no xdg-open equivalent.","solutions":["Run on Windows, macOS, or Linux where a default-program opener exists.","Add a branch mapping to your platform's opener (e.g. FreeBSD may still have xdg-open installed).","Catch PlatformNotSupportedException and show the user the path so they can open it manually."],"exampleFix":"// before\nelse throw new PlatformNotSupportedException(\"Unsupported operating system\");\n\n// after: fall back to xdg-open for any remaining Unix, else tell the user\nelse if (OperatingSystem.IsFreeBSD())\n    Process.Start(new ProcessStartInfo { FileName = \"xdg-open\", Arguments = $\"\\\"{filePath}\\\"\" });\nelse\n    throw new PlatformNotSupportedException($\"No default opener for {RuntimeInformation.OSDescription}\");","handlingStrategy":"validation","validationCode":"if (!OperatingSystem.IsWindows() && !OperatingSystem.IsMacOS() && !OperatingSystem.IsLinux())\n{ /* no opener available; show the path instead */ }","typeGuard":"static bool HasDefaultOpener() =>\n    OperatingSystem.IsWindows() || OperatingSystem.IsMacOS() || OperatingSystem.IsLinux();","tryCatchPattern":"try { FileHelper.OpenFileWithDefaultProgram(path); }\ncatch (PlatformNotSupportedException) { ClipboardSetText(path); showUser(\"Open manually: \" + path); }","preventionTips":["Gate 'Open' actions behind HasDefaultOpener().","On niche Unix, fall back to copying the path to the clipboard."],"tags":["platform","operating-system","process","filesystem"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}