Skip to content

[Bug]: winapp run can hang forever while launching a packaged app when several launches run at once #1035

Closed

Description

Describe the bug

winapp run --detach on a packaged app sometimes never returns. The package is registered, but the command stays stuck in app activation indefinitely, with no timeout and no output.

Every hang so far happened while two or more winapp run processes were launching packaged apps at the same time. The same projects launch fine when run one at a time.

A managed stack of a hung process (dotnet-stack report -p <pid>) shows it blocked in IApplicationActivationManager.ActivateApplication:

winapp!...IApplicationActivationManager.ActivateApplication(...)
winapp!Windows.Win32.UI_Shell_IApplicationActivationManager_Extensions.ActivateApplication(...)
winapp!WinApp.Cli.Services.AppLauncherService.DefaultActivateApplication(...)
winapp!WinApp.Cli.Services.AppLauncherService.LaunchByAumid(...)
winapp!WinApp.Cli.Commands.RunCommand+Handler+...ExecuteRunPipelineAsync...
  ...
winapp!WinApp.Cli.Services.MsixService+<RegisterLooseLayoutPackageAsync>...
winapp!WinApp.Cli.Services.PackageRegistrationService+<DefaultRegisterLoose>...
Microsoft.Windows.SDK.NET!System.AsyncInfoToTaskBridge`2[...DeploymentProgress].Complete(...)

ActivateApplication is called with no timeout. It runs inline on the thread that completed the package deployment, a WinRT async completion callback. The main thread is waiting on the task. Killing the stuck process was the only way out; no app process was ever started.

To Reproduce

  1. Create 3 or 4 packaged WinUI 3 projects with different package identities, e.g. with the generator in tests/project-arch/ (New-ProjectArchFixture).
  2. Start winapp run <App.csproj> --detach --arch <host arch> for all of them at the same time, e.g. with ForEach-Object -Parallel -ThrottleLimit 4.
  3. Some of the processes never exit. In one run, 3 of the first 4 hung for more than an hour; in another, 1 of 2 hung for 17 minutes before I killed it.

Expected behavior

winapp run launches the app and returns its PID. If activation can't complete, it should fail with a clear error after a reasonable timeout rather than waiting forever.

Screenshots

N/A

OS Version and details

Windows 11 Enterprise 10.0.28000 (ARM64). Seen with winapp 0.7.1-based builds and with the build from #1032. Launching one at a time works, which is why tests/project-arch runs its fixtures one after another with a per-fixture timeout.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions