Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,18 @@ stages:
targetType: 'inline'
script: |
New-Item -Path $(Build.SourcesDirectory)\artifacts\CrashDumps -ItemType Directory -Force
<<<<<<< HEAD
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Force | Out-Null
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpFolder" -Value "$(Build.SourcesDirectory)\artifacts\CrashDumps" -PropertyType ExpandString -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpCount" -Value 10 -PropertyType DWord -Force
=======
$localDumpsPath = "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps"
if (-not (Test-Path -LiteralPath $localDumpsPath)) {
New-Item -Path $localDumpsPath -Force | Out-Null
}
New-ItemProperty -Path $localDumpsPath -Name "DumpFolder" -Value "$(Build.SourcesDirectory)\artifacts\CrashDumps" -PropertyType ExpandString -Force
New-ItemProperty -Path $localDumpsPath -Name "DumpCount" -Value 10 -PropertyType DWord -Force
>>>>>>> Create missing crash dump registry key in CI

- script: eng\common\CIBuild.cmd
-configuration $(_BuildConfig)
Expand Down
83 changes: 0 additions & 83 deletions changes.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
#nullable enable
Microsoft.Testing.Extensions.PackagedApp.PackageDeployer
Microsoft.Testing.Extensions.PackagedApp.PackageRegistrationLock
Microsoft.Testing.Extensions.PackagedApp.RegisteredPackageInfo
Microsoft.Testing.Extensions.PackagedApp.RegisteredPackageInfo.FullName.get -> string!
Microsoft.Testing.Extensions.PackagedApp.RegisteredPackageInfo.InstalledPath.get -> string!
Microsoft.Testing.Extensions.PackagedApp.RegisteredPackageInfo.IsDevelopmentMode.get -> bool
Microsoft.Testing.Extensions.PackagedApp.RegisteredPackageInfo.RegisteredPackageInfo(string! fullName, string! installedPath, bool isDevelopmentMode) -> void
static Microsoft.Testing.Extensions.PackagedApp.PackageDeployer.RegisterAsync(string! manifestPath, System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task!>! registerPackage, System.Func<System.Collections.Generic.IReadOnlyList<Microsoft.Testing.Extensions.PackagedApp.RegisteredPackageInfo!>!>! findRegisteredPackages, System.Func<string!, System.Threading.CancellationToken, System.Threading.Tasks.Task!>! removeDevelopmentPackage, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!
static Microsoft.Testing.Extensions.PackagedApp.PackageRegistrationLock.AcquireAsync(string! packageFamilyName, string! lockDirectory, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.IO.FileStream!>!
static Microsoft.Testing.Extensions.PackagedApp.PackageRegistrationLock.AcquireAsync(string! packageFamilyName, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.IO.FileStream!>!
static Microsoft.Testing.Extensions.PackagedApp.PackageRegistrationLock.WithManifestAsync<T>(string! manifestPath, System.Func<Microsoft.Testing.Extensions.PackagedApp.AppxManifestInfo!, System.Threading.Tasks.Task<T>!>! action, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<T>!
static Microsoft.Testing.Extensions.PackagedApp.PackageRegistrationLock.WithManifestAsync<T>(string! manifestPath, System.Func<string!, System.Threading.CancellationToken, System.Threading.Tasks.Task<System.IO.FileStream!>!>! acquireRegistrationLock, System.Func<Microsoft.Testing.Extensions.PackagedApp.AppxManifestInfo!, System.Threading.Tasks.Task<T>!>! action, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<T>!
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
#nullable enable
<<<<<<< HEAD
=======
Microsoft.Testing.Extensions.PackagedApp.ActivatedAppTestHostHandle
Microsoft.Testing.Extensions.PackagedApp.ActivatedAppTestHostHandle.ActivatedAppTestHostHandle(uint processId, string? handshakePath, string? activationPayloadPath) -> void
Microsoft.Testing.Extensions.PackagedApp.ActivatedAppTestHostHandle.Dispose() -> void
Microsoft.Testing.Extensions.PackagedApp.ActivatedAppTestHostHandle.ExitCode.get -> int
Microsoft.Testing.Extensions.PackagedApp.ActivatedAppTestHostHandle.HasExited.get -> bool
Microsoft.Testing.Extensions.PackagedApp.ActivatedAppTestHostHandle.Identifier.get -> string?
Microsoft.Testing.Extensions.PackagedApp.ActivatedAppTestHostHandle.Terminate() -> void
Microsoft.Testing.Extensions.PackagedApp.ActivatedAppTestHostHandle.WaitForExitAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!
Microsoft.Testing.Extensions.PackagedApp.Interop.ApplicationActivationManager
static Microsoft.Testing.Extensions.PackagedApp.Interop.ApplicationActivationManager.ActivateApplication(string! appUserModelId, string? arguments) -> uint
static Microsoft.Testing.Extensions.PackagedApp.PackageDeployer.Activate(string! appUserModelId, string? activationArguments) -> uint
<<<<<<< HEAD
static Microsoft.Testing.Extensions.PackagedApp.PackageDeployer.RegisterAsync(string! manifestPath, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!
>>>>>>> Fix packaged app registration when switching layouts
=======
static Microsoft.Testing.Extensions.PackagedApp.PackageDeployer.RegisterAsync(string! manifestPath, Microsoft.Testing.Extensions.PackagedApp.AppxManifestInfo! manifestInfo, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!
>>>>>>> Keep packaged app manifest and registration state consistent
12 changes: 12 additions & 0 deletions src/Platform/Microsoft.Testing.Extensions.PackagedApp/PACKAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ It is the consumer of the platform's `ITestHostLauncher` extension point for Win
- **Packaged AUMID activation** (Windows build): a packaged (MSIX) layout is registered in place with the `PackageManager` and the app is activated by AUMID via `IApplicationActivationManager`. `packagedClassicApp`/`win32App` hosts receive the platform-prepared command line through `argv`, including when their trust level is `appContainer`. `windowsApp`/UWP hosts receive one opaque launch string and restore the exact logical argument array through `PackagedAppExtensions.GetTestApplicationArguments(args.Arguments)` in `Application.OnLaunched` (see [#10485](https://github.com/microsoft/testfx/issues/10485)). Registering an unsigned build-output layout requires Developer Mode (or sideloading). The plain `net8.0`/`net9.0` build rejects a packaged layout with an actionable error pointing at the Windows TFM.
- **Deploy + launch loose layout** (opt-in): a non-packaged app — one without an `AppxManifest.xml` — is deployed to a deployment directory and the produced executable is launched from there.

## Switching packaged build layouts

Before activation, the launcher verifies that the current user's main package registration points to the directory containing the requested `AppxManifest.xml`. Windows can report registration success while retaining a different layout with the same package identity and version. In that case, the launcher removes only the stale **development registration**, using `PreserveApplicationData`, and registers the requested layout again. Repeated runs from the same layout do not remove its registration.

Launchers serialize the entire registration-and-activation sequence per user and package family, including across processes. Another launcher cannot switch the layout between verification and AUMID activation. Waiting for another launch respects cancellation.

The manifest is held open for reading throughout that sequence, preventing a concurrent rebuild from changing its identity or application declarations. The same parsed identity determines the family lock, registration verification, handoff storage, and activation AUMID.

If cancellation is observed before stale-registration removal starts, no destructive change is made. Once removal completes, the launcher finishes registering and verifying the replacement before it surfaces cancellation, so an interrupted run does not intentionally leave the package unregistered.

If the conflicting package is not a development registration, removal does not actually unregister it, or the requested location still cannot be registered, the launcher reports an error instead of activating another build. A failed replacement can leave the package unregistered, but its application data is retained; resolve the reported deployment error and retry. Callers do not need to uninstall their app or change its version for each build.

## When the launcher takes over

Registering an *enabled* test host launcher switches the run to the test host controller (process restart) model, because a launcher only has an effect when an out-of-process test host is started. To avoid charging that cost to apps that do not need it, the launcher enables itself only when it has real work to do:
Expand Down
Loading
Loading