dotnet/maui · error · System.ComponentModel.Win32Exception
ActivateApplication failed (HRESULT=0x{0:X8})
Error message
ActivateApplication failed (HRESULT=0x{0:X8}) What it means
Thrown by PackagedAppLauncher.Launch when the COM call IApplicationActivationManager.ActivateApplication returns a non-zero HRESULT, wrapped as a Win32Exception. This means Windows could not activate (launch) the packaged app identified by the given Application User Model ID (AUMID).
Source
Thrown at eng/devices/Run-PackagedAppAndWait.ps1:48
using System.Runtime.InteropServices;
[ComImport, Guid("2e941141-7f97-4756-ba1d-9decde894a3d"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IApplicationActivationManager {
int ActivateApplication([In, MarshalAs(UnmanagedType.LPWStr)] string appUserModelId,
[In, MarshalAs(UnmanagedType.LPWStr)] string arguments,
[In] uint options,
[Out] out uint processId);
}
[ComImport, Guid("45BA127D-10A8-46EA-8AB7-56EA9078943C")]
public class ApplicationActivationManager { }
public static class PackagedAppLauncher {
public static uint Launch(string aumid, string arguments) {
var mgr = (IApplicationActivationManager)(new ApplicationActivationManager());
uint pid;
int hr = mgr.ActivateApplication(aumid, arguments ?? string.Empty, 0, out pid);
if (hr != 0) {
throw new System.ComponentModel.Win32Exception(hr,
string.Format("ActivateApplication failed (HRESULT=0x{0:X8})", hr));
}
return pid;
}
}
"@ -ErrorAction SilentlyContinue | Out-Null
[uint32]$procId = 0
try {
$procId = [PackagedAppLauncher]::Launch($aumid, $AppArguments)
} catch {
Write-Error "ActivateApplication threw: $_"
exit 3
}
if ($procId -eq 0) {
Write-Error "ActivateApplication returned PID 0"
exit 3
}View on GitHub (pinned to f377ff1c5e)
Solutions
- Confirm the package is installed and registered: `Get-AppxPackage <packageFullName>` and check the AUMID via `Get-StartApps` or the manifest.
- Re-register or reinstall the appx/msix package if registration is corrupt: `Add-AppxPackage -Register ...AppxManifest.xml`.
- Decode the HRESULT (e.g. 0x80073CFC = APPMODEL_ERROR_NO_PACKAGE) to pinpoint the cause.
- Verify the AUMID string passed matches the package's Application Id from its AppxManifest.
Example fix
# before
$procId = [PackagedAppLauncher]::Launch($wrongAumid, $AppArguments)
# after
# confirm correct AUMID first
Get-AppxPackage *TestCases* | Select-Object PackageFamilyName
$procId = [PackagedAppLauncher]::Launch("$correctPackageFamilyName!App", $AppArguments) Defensive patterns
Strategy: validation
Validate before calling
# Validate package registration + AUMID before launching
$pkg = Get-AppxPackage -Name $packageName
if (-not $pkg) { throw "Package '$packageName' is not installed/registered." }
$aumid = "$($pkg.PackageFamilyName)!$applicationId"
if (-not (Get-StartApps | Where-Object { $_.AppID -eq $aumid })) { throw "AUMID '$aumid' not found." } Try / catch
try {
$procId = [PackagedAppLauncher]::Launch($aumid, $AppArguments)
} catch [System.ComponentModel.Win32Exception] {
Write-Error "Launch failed HRESULT=0x$($_.Exception.NativeErrorCode.ToString('X8')) for AUMID '$aumid'"
throw
} Prevention
- Always derive the AUMID from PackageFamilyName + Application Id rather than hardcoding.
- Confirm Get-AppxPackage returns the package before attempting activation.
- Log the HRESULT so failures are diagnosable; re-register the package on registration errors.
When it happens
Trigger: mgr.ActivateApplication(aumid, arguments, 0, out pid) returns hr != 0. Common HRESULTs include 0x80073CFC (app not registered/installed), 0x80070002 (file not found), or registration/policy errors.
Common situations: The AUMID is wrong or the app package is not installed/registered for the current user; the packaged app was uninstalled or its registration is corrupt; running on a non-packaged build; the app requires a runtime/dependency not present.
Related errors
- Cert {certificateThumbprint} exists in LocalMachine\TrustedP
- Failed to install signing cert into LocalMachine\TrustedPeop
- Error: Couldn't find .cer or .msix file
- Failed to install app MSIX (exit code {installExit}): {msixP
- Unable to find Visual Studio!
AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13).
Data as JSON: /api/errors/34627d1e1a499b7c.
Report an issue: GitHub.