{"record":{"id":"2e88b05d34dcc55a","repo":"ElectronNET/Electron.NET","slug":"this-electron-net-application-was-built-for-buildinforid-it","errorCode":null,"errorMessage":"This Electron.NET application was built for '{buildInfoRid}'. It cannot run on this platform.","messagePattern":"This Electron\\.NET application was built for '(.+?)'\\. It cannot run on this platform\\.","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"critical","filePath":"src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs","lineNumber":153,"sourceCode":"                    {\n                        mismatch = true;\n                    }\n\n                    break;\n\n                case \"freebsd\":\n\n                    if (!RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))\n                    {\n                        mismatch = true;\n                    }\n\n                    break;\n            }\n\n            if (mismatch)\n            {\n                throw new PlatformNotSupportedException($\"This Electron.NET application was built for '{buildInfoRid}'. It cannot run on this platform.\");\n            }\n        }\n\n        protected override Task StopCore()\n        {\n            this.process.Cancel();\n            return Task.CompletedTask;\n        }\n\n        private async Task StartInternal(string startCmd, string args, string directory)\n        {\n            var tcs = new TaskCompletionSource();\n            using var cts = new CancellationTokenSource(2 * 60_000); // cancel after 2 minutes\n            using var _ = cts.Token.Register(() =>\n            {\n                // Time is over - let's kill the process and move on\n                this.process.Cancel();\n                // We don't want to raise exceptions here - just pass the barrier","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/ElectronNET/Electron.NET/blob/87cc6f98b6a9c5968d7846c0e775ea713bd0d7b2/src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs#L135-L171","documentation":"ElectronProcessActive.CheckRuntimeIdentifier compares the RID the app was built for (buildInfoRid) against the current OS/architecture and throws PlatformNotSupportedException when they cannot run together (e.g. a win7-x64 build launched on Linux). This guards against launching an Electron binary that cannot execute on the host.","triggerScenarios":"Publishing/porting the app with a runtime identifier (e.g. win-x64) and running it on a different OS or architecture, such as moving a Windows build to Linux or an x64 build onto ARM.","commonSituations":"Copying build output between machines/containers of a different OS; CI publishing with --runtime for one platform but deploying to another; missing RID in buildInfo causing a mismatch; Docker image base OS mismatch.","solutions":["Rebuild/re-publish for the target platform: dotnet publish -r linux-x64 (or the matching RID)","Ensure the deploy environment OS/arch matches the build RID","Check buildInfo (electronbuildinfo.json / build metadata) points at the correct RID","For self-contained deployments, publish per-platform artifacts and deploy the matching one"],"exampleFix":"// before\ndotnet publish -r win-x64 --self-contained false   # then run on Linux\n// after\ndotnet publish -r linux-x64 --self-contained false  # run on Linux","handlingStrategy":"validation","validationCode":"var rid = GetBuildInfoRid(); // from electronbuildinfo.json\nvar current = RuntimeInformation.ProcessArchitecture;\nbool compatible = (OperatingSystem.IsWindows() && rid.StartsWith(\"win\") ||\n                   OperatingSystem.IsLinux() && rid.StartsWith(\"linux\") ||\n                   OperatingSystem.IsMacOS() && rid.StartsWith(\"osx\"))\n                  && rid.EndsWith(current.ToString().ToLower());\nif (!compatible) throw new PlatformNotSupportedException($\"Build RID {rid} incompatible with current platform\");","typeGuard":null,"tryCatchPattern":"try\n{\n    await ElectronBootstrap.LaunchAsync();\n}\ncatch (PlatformNotSupportedException ex)\n{\n    logger.LogCritical(ex, \"Runtime identifier mismatch — rebuild for {Platform}\", Environment.OSVersion.Platform);\n    Environment.Exit(1);\n}","preventionTips":["Publish with the -r flag matching every deploy target","Verify OS/architecture in CI before deploying artifacts","Keep electronbuildinfo.json in sync with the publish RID","For containers, confirm the base image OS matches the RID"],"tags":["platform","runtime-identifier","deployment"],"backgroundTag":"unsupported-platform","analyzedSha":"87cc6f98b6a9c5968d7846c0e775ea713bd0d7b2","analyzedAt":"2026-09-14T03:09:47.608Z","contentChangedAt":"2026-09-14T03:09:47.608Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}