{"record":{"id":"9c740383e839998a","repo":"stride3d/stride","slug":"unable-to-locate-the-executable-for-the-selected-version","errorCode":null,"errorMessage":"Unable to locate the executable for the selected version","messagePattern":"Unable to locate the executable for the selected version","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/launcher/Stride.Launcher/ViewModels/StrideVersionViewModel.cs","lineNumber":297,"sourceCode":"\n        // Use the pre-computed editor → directory map from UpdateAvailableEditors.\n        // Each editor may live in a different package directory and a different TFM subfolder\n        // (e.g. net10.0 for Avalonia, net10.0-windows7.0 for WPF), so we store the fully\n        // resolved directory rather than re-applying SelectedFramework here.\n        foreach (var gameStudioExecutable in GetPreferredExecutableNames())\n        {\n            var editorName = Path.GetFileNameWithoutExtension(gameStudioExecutable);\n            if (_editorToDir.TryGetValue(editorName, out var dir))\n            {\n                var gameStudioPath = Path.Combine(dir, gameStudioExecutable);\n                if (File.Exists(gameStudioPath))\n                    return gameStudioPath;\n            }\n        }\n\n        // Otherwise, old-style fallback\n        return GetMainExecutables().Select(x => Path.Combine(InstallPath, x)).FirstOrDefault(File.Exists)\n            ?? throw new InvalidOperationException(\"Unable to locate the executable for the selected version\");\n\n        static IEnumerable<string> GetMainExecutables()\n        {\n            // some old paths used in previous versions\n            if (OperatingSystem.IsWindows())\n            {\n            yield return @$\"lib\\net472\\{GameStudioNames.Stride}.exe\";\n            }\n        }\n    }\n\n    /// <summary>\n    /// Returns the executable file names in preference order: the selected editor first, then the\n    /// remaining editors in their default priority order.\n    /// </summary>\n    private IEnumerable<string> GetPreferredExecutableNames()\n    {\n        var ext = OperatingSystem.IsWindows() ? \".exe\" : \".dll\";","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/launcher/Stride.Launcher/ViewModels/StrideVersionViewModel.cs#L279-L315","documentation":"LocateMainExecutable resolves the main GameStudio/launcher executable for a selected Stride version. It first checks known per-version paths and finally falls back to probing a list of legacy executable names under InstallPath. When none of those files exist on disk, it throws this InvalidOperationException to signal the installed version cannot be located.","triggerScenarios":"Calling LocateMainExecutable for a version whose install directory is missing, incomplete, or whose executable name does not match any of the known or legacy paths (e.g. a renamed or restructured build).","commonSituations":"A version registered in the launcher but its folder deleted manually; a partially failed/interrupted install; very old or custom builds whose exe names predate the fallback list; case/extension mismatches (Stride.GameStudio.exe vs .Editor.exe) across historical versions.","solutions":["Verify InstallPath exists and contains the expected executable; reinstall the version if not","Add the version's actual executable name to the known paths or GetMainExecutables legacy list","Check the version's registry/package metadata points at the correct install directory","Handle the exception in the UI by offering to re-download the version"],"exampleFix":"// before\nvar exe = version.LocateMainExecutable();\n// after\nif (!Directory.Exists(version.InstallPath) || !Directory.EnumerateFiles(version.InstallPath, \"*.exe\").Any())\n{\n    PromptReinstall(version);\n    return;\n}\nvar exe = version.LocateMainExecutable();","handlingStrategy":"validation","validationCode":"var exePath = Directory.EnumerateFiles(installPath, \"*.exe\", SearchOption.TopDirectoryOnly).FirstOrDefault();\nif (exePath == null || !Directory.Exists(installPath)) PromptReinstall(version);","typeGuard":"static bool IsVersionInstalled(StrideVersionViewModel v) => v?.InstallPath != null && Directory.Exists(v.InstallPath) && Directory.EnumerateFiles(v.InstallPath, \"*.exe\").Any();","tryCatchPattern":"try { var exe = version.LocateMainExecutable(); } catch (InvalidOperationException) { OfferReinstall(version); }","preventionTips":["Validate install directories when registering versions","Re-probe the filesystem after installs instead of trusting cached state","Keep the legacy executable-name list updated when paths change across versions","Surface missing executables in the version list UI before launching"],"tags":["file-not-found","installation","executable","versioning"],"backgroundTag":"file-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}