{"record":{"id":"08204989b5c4b5be","repo":"Orbmu2k/nvidiaProfileInspector","slug":"no-update-release-was-selected","errorCode":null,"errorMessage":"No update release was selected.","messagePattern":"No update release was selected\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"nvidiaProfileInspector/Common/Updates/InplaceUpdateInstaller.cs","lineNumber":17,"sourceCode":"using System;\nusing System.Diagnostics;\nusing System.IO;\nusing System.IO.Compression;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Reflection;\nusing System.Threading.Tasks;\n\nnamespace nvidiaProfileInspector.Common.Updates\n{\n    public sealed class InplaceUpdateInstaller : IUpdateInstaller\n    {\n        public async Task PrepareAndRunAsync(UpdateRelease release)\n        {\n            if (release == null)\n                throw new InvalidOperationException(\"No update release was selected.\");\n\n            if (!release.IsInstallable)\n                throw new InvalidOperationException(\"The selected release does not contain a downloadable update package.\");\n\n            var tempRoot = Path.Combine(Path.GetTempPath(), \"nvidiaProfileInspector-update-\" + Guid.NewGuid().ToString(\"N\"));\n            Directory.CreateDirectory(tempRoot);\n\n            var assetPath = Path.Combine(tempRoot, SanitizeFileName(release.Asset.Name ?? \"update.zip\"));\n            await DownloadFileAsync(release.Asset.DownloadUrl, assetPath);\n\n            var sourcePath = PrepareUpdateSource(tempRoot, assetPath, release.Asset.PackageType);\n            var appDirectory = AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);\n            var executablePath = Assembly.GetEntryAssembly()?.Location ?? Process.GetCurrentProcess().MainModule.FileName;\n            var scriptPath = Path.Combine(tempRoot, \"apply-update.cmd\");\n\n            File.WriteAllText(scriptPath, CreateUpdateScript(Process.GetCurrentProcess().Id, tempRoot, sourcePath, appDirectory, executablePath));\n\n            Process.Start(new ProcessStartInfo","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/Orbmu2k/nvidiaProfileInspector/blob/2f50c388b3a4d661cade66b32746bec096d1eee1/nvidiaProfileInspector/Common/Updates/InplaceUpdateInstaller.cs#L1-L35","documentation":"InvalidOperationException thrown by InplaceUpdateInstaller.PrepareAndRunAsync when the release argument is null. A distinct message from the not-installable case, indicating the caller passed no release at all to the in-place self-update routine.","triggerScenarios":"Passing a null UpdateRelease to PrepareAndRunAsync, e.g. a UI field not yet bound, an async update-check that returned null, or an IUpdateInstaller invoked with default(T).","commonSituations":"Race where the user clicks Install before the release download/check completes; DI wiring invoking the installer with a missing release; filtering removed all releases but the install command stayed enabled.","solutions":["Null-check the release before invoking the installer (or make the command's CanExecute depend on Release != null)","Ensure update-check completes and assigns the release before enabling install","Catch the InvalidOperationException and no-op or prompt the user to re-check for updates","Return early in the caller when the selected release is null"],"exampleFix":"// before\nawait installer.PrepareAndRunAsync(selectedRelease);\n// after\nif (selectedRelease != null)\n    await installer.PrepareAndRunAsync(selectedRelease);","handlingStrategy":"validation","validationCode":"if (release is null) return; // or disable the command","typeGuard":"bool HasRelease(UpdateRelease release) => release is not null;","tryCatchPattern":"try { await installer.PrepareAndRunAsync(release); }\ncatch (InvalidOperationException) { /* no release selected — re-check for updates */ }","preventionTips":["Make CanExecute depend on Release != null","Await the update check before enabling the install action","Avoid invoking IUpdateInstaller with default(T)","Initialize the selected release in the constructor, not lazily"],"tags":["update","null-argument","invalid-operation"],"backgroundTag":"null-argument","analyzedSha":"2f50c388b3a4d661cade66b32746bec096d1eee1","analyzedAt":"2026-09-15T05:23:52.218Z","contentChangedAt":"2026-09-15T05:23:52.218Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}