SubtitleEdit/subtitleedit · critical · PlatformNotSupportedException

Unsupported Windows architecture.

Error message

Unsupported Windows architecture.

What it means

Thrown by LibVlcDownloadService.GetUrl() in the default case of the Windows architecture switch. Windows URLs are defined only for X64 (WindowsX64Url) and X86 (WindowsX86Url); an ARM64 Windows process (or any other Architecture) hits the default PlatformNotSupportedException.

Source

Thrown at src/ui/Logic/Download/LibVlcDownloadService.cs:44

    }

    public async Task DownloadLibVlc(Stream stream, IProgress<float>? progress, CancellationToken cancellationToken)
    {
        await DownloadHelper.DownloadFileAsync(httpClient, GetUrl(), stream, progress, cancellationToken);
    }

    private string GetUrl()
    {
        if (OperatingSystem.IsWindows())
        {
            switch (RuntimeInformation.ProcessArchitecture)
            {
                case Architecture.X64:
                    return WindowsX64Url;
                case Architecture.X86:
                    return WindowsX86Url;
                default:
                    throw new PlatformNotSupportedException("Unsupported Windows architecture.");
            }
        }

        if (OperatingSystem.IsMacOS())
        {
            switch (RuntimeInformation.ProcessArchitecture)
            {
                // case Architecture.Arm64:
                //     return MacArmUrl; // e.g., for M1, M2, M3, M4, M5 chips
                case Architecture.X64:
                    return MacX64Url;
            }
        }

        throw new PlatformNotSupportedException("LibVLC download is not supported on this platform");
    }
}

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Run the app as an x64 (or x86) process on Windows so the matching LibVLC URL is selected.
  2. If Windows-on-ARM64 must be supported, obtain an ARM64 LibVLC build and add a WindowsArm64Url plus its case in the switch.
  3. At the caller, detect Windows+non-X64/X86 and disable LibVLC-based playback gracefully.

Example fix

// before
switch (RuntimeInformation.ProcessArchitecture)
{
    case Architecture.X64: return WindowsX64Url;
    case Architecture.X86: return WindowsX86Url;
    default: throw new PlatformNotSupportedException("Unsupported Windows architecture.");
}

// after: add ARM64 Windows support
switch (RuntimeInformation.ProcessArchitecture)
{
    case Architecture.X64:   return WindowsX64Url;
    case Architecture.X86:   return WindowsX86Url;
    case Architecture.Arm64: return WindowsArm64Url;
    default: throw new PlatformNotSupportedException($"Unsupported Windows architecture: {RuntimeInformation.ProcessArchitecture}.");
}
Defensive patterns

Strategy: validation

Validate before calling

static bool IsLibVlcSupportedOnWindows()
    => !OperatingSystem.IsWindows()
       || RuntimeInformation.ProcessArchitecture is Architecture.X64 or Architecture.X86;

if (!IsLibVlcSupportedOnWindows()) { DisableLibVlcPlayback(); return; }

Type guard

static bool LibVlcWindowsSupported()
    => !OperatingSystem.IsWindows()
       || RuntimeInformation.ProcessArchitecture is Architecture.X64 or Architecture.X86;

Try / catch

try { var url = vlcService.GetUrl(); }
catch (PlatformNotSupportedException ex) when (OperatingSystem.IsWindows() && ex.Message.Contains("Windows architecture"))
{ _logger.Warning("LibVLC has no build for Windows {Arch}", RuntimeInformation.ProcessArchitecture); DisableLibVlcPlayback(); }

Prevention

When it happens

Trigger: Running on Windows where ProcessArchitecture is neither X64 nor X86 — most notably Windows-on-ARM64 (Surface Pro X, Snapdragon X). Also reachable on any future Architecture enum value on Windows.

Common situations: Windows-on-ARM devices; .NET process forced to ARM64 on an ARM64 Windows host; ARM64 dev/CI runner on Windows. LibVLC binaries for Windows ARM64 are not wired up here, hence the guard.

Related errors


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