Skip to content

When the operation lacks permission, different platforms throw exceptions that are not unified. #1

@Linlccc

Description

@Linlccc

Bug Description

The following are specific exception messages when using different platforms and engines:

  • Windows
    • Registry - Throws System.UnauthorizedAccessException
    • StartupFolder - Throws System.UnauthorizedAccessException
    • TaskScheduler - Throws AutoLaunch.Exceptions.ExecuteCommandException. Error message contains HRESULT: 0x80070005
  • Linux
    • Freedesktop - Throws System.UnauthorizedAccessException
  • macOS
    • LaunchAgent - Throws System.UnauthorizedAccessException
    • AppleScript - Throws AutoLaunch.Exceptions.ExecuteCommandException. Error message contains error code: -1743

Steps to Reproduce

Using the following configuration to build and then enabel, the above described exception will be thrown (you need to make sure that the current program does not have permission to operate)

  • WindowsEngine.Registry + WorkScope.AllUser
  • WindowsEngine.StartupFolder + WorkScope.AllUser
  • WindowsEngine.TaskScheduler
  • LinuxEngine.Freedesktop + WorkScope.AllUser
  • MacOSEngine.LaunchAgent + WorkScope.AllUser
  • MacOSEngine.AppleScript

Expected Behavior

A unified exception is thrown when different platforms and engines do not have permission

Environment Information

  • OS: macOS 15.6
  • OS: ubuntu 24.04
  • OS: Windows 11
  • .NET: .net 9.0.x
  • AutoLaunch: 1.0.0-preview.1

Additional Information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions