0

I set up a self-hosted runner to run my UWP tests (on Windows 10). The tests run fine when I am locally connected via RDC and run vstest.console.exe from a powershell. The exact same command does give below error (UnauthorizedAccessException: Access is denied.) when executed as a runner via Github Actions. I then set up a runner with an admin account, but it results in the same error.

My assumption is that it has something to do with privileges of the runner itself, and with the fact that UWP tests are actually ran via a package that first needs be installed and then executed as an app. However, when I run the test app via a Github-hosted runner (also using vstest.console.exe), it all runs fine. Thus I am sure that there must be a way to run it. FYI, I am literally using the same action, just one runs on "self-hosted" the other on "windows-latest".

Does anyone have an idea why I get the error and how to resolve it?

'UnitTesterUWP_1.0.0.0_x64__gwkdyh6xmv8h8'.
Attempting to launch app with app user model Id 'UnitTesterUWP_gwkdyh6xmv8h8!vstest.executionengine.universal.App' and arguments '--port 57663 --endpoint 127.0.0.1:057663 --role client --parentprocessid 32412 --local-path "C:\actions-runner\_work\MY_App\MY_App\repoMY_App\x64\Release\MY_UNITTEST_WIN_UWP" --datacollectionport 57662 --telemetryoptedin false'.
Deploy: END (Success, 0:00:00,935)
UnauthorizedAccessException: Access is denied.

Access is denied.

   at Microsoft.VisualStudio.Deployment.IPackageDebugSettings.EnableDebugging(String packageFullName, String debuggerCommandLine, String environment)
App activation failed.
   at Microsoft.VisualStudio.Deployment.LocalAppActivationDriver.LaunchAppLocally(String appUserModelId, String packageFullName, String launchArgs, String architecture)
   at Microsoft.VisualStudio.Deployment.LocalAppActivationDriver.Microsoft.VisualStudio.Deployment.IAppActivationDriver.LaunchAppAsync(String appUserModelId, String packageFullName, String launchArgs, String target, String architecture)
   at Microsoft.VisualStudio.Deployment.Service.<Microsoft-UniversalApps-Deployment-IAppLauncher-LaunchAppAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Deployer.<Microsoft-VisualStudio-UwpTestHostRuntimeProvider-IDeployer-ActivateAsync>d__53.MoveNext()
Failed to initialize client proxy: could not connect to test process.
Closing app with package full name 'UnitTesterUWP_1.0.0.0_x64__gwkdyh6xmv8h8'.
UnauthorizedAccessException: Access is denied.

Access is denied.

Closing the app failed.
   at Microsoft.VisualStudio.Deployment.IPackageDebugSettings.TerminateAllProcesses(String packageFullName)
   at Microsoft.VisualStudio.Deployment.LocalAppActivationDriver.Microsoft.VisualStudio.Deployment.IAppActivationDriver.CloseAppAsync(String appUserModelId, String packageFullName, String target, String architecture)
   at Microsoft.VisualStudio.Deployment.Service.<Microsoft-UniversalApps-Deployment-IAppLauncher-CloseAppAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Deployer.<Microsoft-VisualStudio-UwpTestHostRuntimeProvider-IDeployer-CloseAppAsync>d__54.MoveNext()


Test Run Aborted.
Dr.J
  • 334
  • 3
  • 12
  • I am suspecting that this is the underlying difference (taken from Github actions documentation): "Windows virtual machines are configured to run as administrators with User Account Control (UAC) disabled. For more information, see "How User Account Control works" in the Windows documentation." – Dr.J Oct 27 '22 at 10:51
  • `windows-latest` is upon Windows Server, https://github.com/actions/runner-images So I don't think UWP is ever fully supported there. – Lex Li Oct 27 '22 at 14:50
  • Eh no, the point is that it works perfectly fine under windows-latest, just not self-hosted. – Dr.J Oct 28 '22 at 10:43
  • Which account do you use to run the self hosted GitHub Actions agent? Your own account or a service account? – Lex Li Oct 28 '22 at 15:57
  • I tried with my own account, and with an admin account. I also tried as nt authority/system, but then I wasn’t allowed to install any dependent packages (c++ resist). – Dr.J Oct 28 '22 at 21:00
  • I might try to not run it as a service, see https://stackoverflow.com/a/58958796/4495310 – Dr.J Oct 28 '22 at 21:03

1 Answers1

0

The only solution I found now is to start the runner manually after login (e.g. via autostart). As testing a UWP app requires to open a window, it seems to be required to have an active user session. I can RDP to the test machine, log in, start the runner, and then close RDP. So, eventually I will probably configure the RDP machine to auto login with a test user account, that autostarts the Github runner. In any case, using the Github runner as a service or starting it via task scheduler did not work.

Dr.J
  • 334
  • 3
  • 12