Problem
AutostartManager.EnableWithOptions accepts a stable AutostartOptions.Identifier, but Disable discovers registrations by the current executable instead of deleting that identifier. On Windows, a Run value left by an older installation path cannot be removed after the executable moves. The same discovery-based mismatch exists for Linux desktop files and macOS LaunchAgents.
A consumer can work around this by calling EnableWithOptions and then Disable, but that is not failure-atomic: if enable succeeds and disable fails, a previously disabled app becomes registered at login. Retrying the same sequence cannot reliably restore the disabled state.
Reproduction
- Write a Windows Run value under a stable identifier, with the command pointing to an old executable path.
- Start the application from a new path.
- Call
AutostartManager.Disable().
- The stable value remains because
windowsAutostart.find() matches only the current executable.
Proposed API
Add DisableWithOptions(AutostartOptions) (or an equivalent identifier-targeted operation) that validates and removes the exact registration identity used by EnableWithOptions. Keep existing Disable() behavior for compatibility.
Acceptance
- Windows removes the exact registry value even when its command points to a moved executable.
- Linux removes the exact
.desktop filename.
- macOS removes the exact LaunchAgent label while preserving SMAppService cleanup.
- Empty options retain the existing default behavior.
- Invalid identifiers are rejected consistently.
- Native/platform tests cover idempotency and moved executable state.
Problem
AutostartManager.EnableWithOptionsaccepts a stableAutostartOptions.Identifier, butDisablediscovers registrations by the current executable instead of deleting that identifier. On Windows, a Run value left by an older installation path cannot be removed after the executable moves. The same discovery-based mismatch exists for Linux desktop files and macOS LaunchAgents.A consumer can work around this by calling
EnableWithOptionsand thenDisable, but that is not failure-atomic: if enable succeeds and disable fails, a previously disabled app becomes registered at login. Retrying the same sequence cannot reliably restore the disabled state.Reproduction
AutostartManager.Disable().windowsAutostart.find()matches only the current executable.Proposed API
Add
DisableWithOptions(AutostartOptions)(or an equivalent identifier-targeted operation) that validates and removes the exact registration identity used byEnableWithOptions. Keep existingDisable()behavior for compatibility.Acceptance
.desktopfilename.