{"record":{"id":"ebdfb7148f376a32","repo":"Orbmu2k/nvidiaProfileInspector","slug":"drs-restorealldefaults","errorCode":null,"errorMessage":"DRS_RestoreAllDefaults","messagePattern":"DRS_RestoreAllDefaults","errorType":"exception","errorClass":"NvapiException","httpStatus":null,"severity":"error","filePath":"nvidiaProfileInspector/Common/DrsSettingsService.cs","lineNumber":244,"sourceCode":"            {\r\n                var hProfile = CreateProfile(hSession, profileName);\r\n\r\n                if (applicationName != null)\r\n                    AddApplication(hSession, hProfile, applicationName);\r\n\r\n                SaveSettings(hSession);\r\n            });\r\n        }\r\n\r\n        public void ResetAllProfilesInternal()\r\n        {\r\n            RunDrsInitProcess();\r\n\r\n            DrsSession((hSession) =>\r\n            {\r\n                var nvRes = nvw.Instance.DRS_RestoreAllDefaults(hSession);\r\n                if (nvRes != NvAPI_Status.NVAPI_OK)\r\n                    throw new NvapiException(\"DRS_RestoreAllDefaults\", nvRes);\r\n\r\n                SaveSettings(hSession);\r\n            });\r\n        }\r\n\r\n        public void ResetProfile(string profileName, out bool removeFromModified)\r\n        {\r\n            bool tmpRemoveFromModified = false;\r\n            DrsSession((hSession) =>\r\n            {\r\n                var hProfile = GetProfileHandle(hSession, profileName);\r\n                var profile = GetProfileInfo(hSession, hProfile);\r\n\r\n                if (profile.isPredefined == 1)\r\n                {\r\n                    var nvRes = nvw.Instance.DRS_RestoreProfileDefault(hSession, hProfile);\r\n                    if (nvRes != NvAPI_Status.NVAPI_OK)\r\n                        throw new NvapiException(\"DRS_RestoreProfileDefault\", nvRes);\r","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/Orbmu2k/nvidiaProfileInspector/blob/2f50c388b3a4d661cade66b32746bec096d1eee1/nvidiaProfileInspector/Common/DrsSettingsService.cs#L226-L262","documentation":"NvapiException(\"DRS_RestoreAllDefaults\", status) is thrown when the driver-wide DRS_RestoreAllDefaults call fails, aborting a reset of ALL driver profiles to factory defaults. Because this operation is destructive and non-granular, a partial failure can leave the settings store in an intermediate state.","triggerScenarios":"ResetAllProfilesInternal runs RunDrsInitProcess, opens a global DrsSession, and calls nvw.Instance.DRS_RestoreAllDefaults(hSession); any non-NVAPI_OK result throws at DrsSettingsService.cs:244 before SaveSettings is reached.","commonSituations":"Driver settings store corrupted, so the driver cannot enumerate and reset all profiles; another application (NVIDIA Control Panel) holds the store concurrently; insufficient permissions for the destructive reset; driver update in progress.","solutions":["Close NVIDIA Control Panel and other DRS clients, then retry the reset","Run the application as administrator","Update/reinstall the NVIDIA driver if the settings database is corrupted (nvdisps corruption)","As a granular fallback, reset individual profiles via ResetProfile instead of all at once","Catch NvapiException and warn the user which phase failed; check whether settings were partially reset"],"exampleFix":"// before\nsettingsService.ResetAllProfiles();\n// after\ntry { settingsService.ResetAllProfiles(); }\ncatch (NvapiException ex)\n{\n    Log.Error($\"RestoreAllDefaults failed: {ex.Status}\");\n    MessageBox.Show(\"Reset failed. Your settings may be partially restored.\");\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    settingsService.ResetAllProfiles();\n}\ncatch (NvapiException ex)\n{\n    Log.Error($\"RestoreAllDefaults failed: {ex.Status}\");\n    WarnUserOfPartialReset();\n}","preventionTips":["Warn users that reset affects ALL profiles and get confirmation","Close other DRS clients before resetting","Run elevated for the destructive reset","Offer per-profile ResetProfile as a granular, safer alternative","Verify driver store health (settings load) before attempting a full reset"],"tags":["nvapi","drs","reset","driver-settings"],"backgroundTag":"api-error-response","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"}