Orbmu2k/nvidiaProfileInspector · error · NvapiException
DRS_CreateApplication
Error message
DRS_CreateApplication
What it means
NvapiException thrown by AddApplication when DRS_CreateApplication returns a non-OK status other than NVAPI_EXECUTABLE_ALREADY_IN_USE (which is intercepted for bug mitigation). It means the driver refused to register the executable in the profile. The wrapped NvAPI_Status gives the exact reason.
Solutions
- Check the NvapiException Status; if NVAPI_EXECUTABLE_ALREADY_IN_USE, the library's MitigateNvapiAlreadyInUseBug path should handle it — verify it ran.
- Ensure applicationName is a valid executable file name and fileInFolder points to its directory, matching NVDRS_APPLICATION field expectations.
- Confirm the hProfile handle is valid and the profile still exists.
- Delete the duplicate application registration from the other profile (DRS_DeleteApplicationEx) and retry.
Example fix
// before
if (caRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_CreateApplication", caRes);
// after
if (caRes == NvAPI_Status.NVAPI_EXECUTABLE_ALREADY_ON_PROFILE)
return; // already registered, nothing to do
if (caRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_CreateApplication", caRes); Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(applicationName) ||
applicationName.Contains("\\") || applicationName.Contains("/"))
throw new ArgumentException("applicationName must be a bare executable file name"); Try / catch
try { AddApplication(hSession, hProfile, appName, folder); }
catch (NvapiException ex) when (ex.Status == NvAPI_Status.NVAPI_EXECUTABLE_ALREADY_IN_USE)
{ /* already registered elsewhere - decide whether to remove and re-add */ }
catch (NvapiException ex)
{ log.Error($"DRS_CreateApplication failed: {ex.Status}"); throw; } Prevention
- Pass only the executable filename, not a full path, as the application name.
- Check whether the app is already attached to another profile before adding.
- Use matching struct version (V4) for the driver in use.
- Ensure the profile handle is valid before AddApplication.
When it happens
Trigger: AddApplication calls DRS_CreateApplication with an NVDRS_APPLICATION_V4 and the driver returns a failure status — invalid appName format, missing path/filename fields, invalid profile handle, or the executable already registered in another profile.
Common situations: Adding an app whose name is not a plain executable filename; adding an app already attached to another profile; wrong NVDRS_APPLICATION version field; stale hProfile handle.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
AI-assisted analysis of Orbmu2k/nvidiaProfileInspector@2f50c388b3 (2026-09-15).
Data as JSON: /api/errors/39133ebbfb0e671b.
Report an issue: GitHub.
Appendix: source
Thrown at nvidiaProfileInspector/Common/DrsSettingsServiceBase.cs:251
}
protected void AddApplication(IntPtr hSession, IntPtr hProfile, string applicationName)
{
var newApp = new NVDRS_APPLICATION_V4()
{
version = nvw.NVDRS_APPLICATION_VER_V4,
appName = applicationName,
};
var caRes = nvw.Instance.DRS_CreateApplication(hSession, hProfile, ref newApp);
if (caRes == NvAPI_Status.NVAPI_EXECUTABLE_ALREADY_IN_USE)
{
if (MitigateNvapiAlreadyInUseBug(hSession, hProfile, newApp)) return;
}
if (caRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_CreateApplication", caRes);
}
protected void AddApplication(IntPtr hSession, IntPtr hProfile, string applicationName, string fileInFolder)
{
var newApp = new NVDRS_APPLICATION_V4()
{
version = nvw.NVDRS_APPLICATION_VER_V4,
appName = applicationName,
fileInFolder = fileInFolder
};
var caRes = nvw.Instance.DRS_CreateApplication(hSession, hProfile, ref newApp);
if (caRes == NvAPI_Status.NVAPI_EXECUTABLE_ALREADY_IN_USE)
{
if (MitigateNvapiAlreadyInUseBug(hSession, hProfile, newApp)) return;
}View on GitHub (pinned to 2f50c388b3)