Open
Description
Describe the bug
When I try to start a WinUI 3 app by elevating it with program code, it fails to start with a 0xc0000142 error under some conditions.
Steps to reproduce the bug
- Log in to Windows as a non-administrator.
- Create an app that elevates itself and launches when the “elevate” button is clicked. (<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>)
- [OK] Double-click exe to launch the app: “elevate” button works well.
- Distribute the apps in Microsoft Store.
- Install the app from Microsoft Store.
- [NG] Launch the app from the Start menu: “elevate” button try to launch elevated instance, but failed.
Sample program in GitHub:
https://github.com/shinta0806/TestElevation
Expected behavior
Elevation works.
Screenshots
NuGet package version
WinUI 3 - Windows App SDK 1.5.2: 1.5.240404000
Windows version
Windows 11 (22H2): Build 22621
Additional context
OK patterns
- .exe double click
- .exe right click -> run as admin
- side loading
- Install and launch from Microsoft Store as an administrator
NG patterns
- Install and launch from Microsoft Store as a non-admin user
- (But, once elevated as an administrator, the elevation is available to non-administrator users.)
- Run from Visual Studio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment