Repository navigation
[rel/4.5] Backport packaged-app SDK environment isolation - #11854
Conversation
Backport #11828 and resolve directly coupled servicing merge artifacts while preserving bootstrap, launch-profile, filter and cleanup contracts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5cb3e91b-2f12-40f1-b862-e1ddb398b7e5
Preserve the serviced bootstrap, launch-profile and informational-response documentation; remove obsolete merge variants responsible for new-head markdownlint failures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5cb3e91b-2f12-40f1-b862-e1ddb398b7e5
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
Summary
Reviewed the full diff (28 files, docs/pipeline/MSBuild targets/C#/tests/localization) for this rel/4.5 backport of #11828. This PR is almost entirely git-conflict cleanup (resolving <<<<<<</=======/>>>>>>> markers left by a prior merge) plus a genuine new feature: aligning a nested SDK's MSBuildSDKsPath/MSBuildExtensionsPath/DOTNET_ROOT_X64/etc. with the CLI actually invoked, so a parent dotnet test's exported SDK environment can't leak into native/packaged-app child processes.
What I checked
- Conflict-marker hygiene (all 28 files in the diff): every file touched by this PR resolves cleanly — no stray
<<<<<<</=======/>>>>>>>remain indocs/winui-testing.md, the pipeline YAML,Program.cs,PackagedAppControllerArguments.cs, the MSBuild.targets,PACKAGE.md, the.resx/.xlfcatalogs, or the test files. - Localization (
ExtensionResources.resx+ 13.xlfcatalogs): the diff correctly removes a duplicated/stray<value>/<source>/<target>pair forPackagedAppControllerNativeLauncherDisabledleft over from the merge conflict; the retained single entry matches the current (non-"Native"-prefixed) message and all locked tokens remain intact. Clean. PackagedAppControllerArguments.Configure: the resolved version keeps theCommandLineParser.Parse(...).IsOptionSet(...)case-insensitive matching (verifiedParseResult.IsOptionSetusesStringComparison.OrdinalIgnoreCaseand trims-/--prefixes), so the "Match native informational switches case-insensitively" behavior from the conflicting branch is preserved without manual casing logic. Unit tests (Configure_HelpAndDiscoverySelectActualHostWithOrWithoutNativeTransport) cover-?,--?,--help,--list-tests,-list-tests.- MSBuild
.targets:_ConfigureTestingPlatformPackagedAppRunArgumentsnow depends on_PrepareTestingPlatformPackagedAppRunController(project-local staged controller) rather than the old_ConfigureTestingPlatformPackagedAppEnvironment/inline-prefix approach, consistent with the new bootstrap-file design;RunCommand/RunArgumentswiring and the new_PrepareTestingPlatformPackagedAppRunController/_RecordTestingPlatformPackagedAppRunControllerFilestargets resolve consistently withProgram.cs's bootstrap-file reading logic. ConfigureDotnetSdkEnvironment(new helper inAcceptanceTestBase.cs): correctly derivesdotnetRoot/sdkDirectoryfrom the passeddotnetPath/sdkVersion, setsMSBuildSDKsPath,MSBuildExtensionsPath,DOTNET_ROOT,DOTNET_ROOT_X64,DOTNET_INSTALL_DIR,DOTNET_MULTILEVEL_LOOKUP=0,MSBUILDUSESERVER=0. Covered by a dedicated data-driven unit test (NativeSdkEnvironment_AlignsSdkPathsAndPreservesSharedTooling) that verifies both the "clean environment" and "inherited conflicting SDK" cases, and preserves unrelated keys likeNUGET_PACKAGES/MSBUILDLOGIMPORTS. Good regression coverage.PackagedWinUITests.csprobe-environment regression test: deliberately seedsprobeEnvironmentwith wrong "parent-sdk"/"parent-dotnet" paths so the standaloneProbe-Extensions.ps1script must self-correct them — a solid test for the isolation fix working independent of the C#-side helper.Probe-Extensions.ps1: saves/restores previous env-var values in afinallyblock (no permanent mutation of the parent shell), matching the README's claim "without changing the parent shell's environment or the shared NuGet cache."- Test asset lifecycle:
GenerateAssetAsync's callers switched fromusing TestAsset asset = ...to a bareTestAsset asset = ...passed intoWindowsApplicationModelTestTools.ExecuteWithPackageCleanupAsync(asset, identity, action). VerifiedExecuteWithPackageCleanupAsyncitself callstestAsset.Dispose()on success internally, so disposal is not dropped — just relocated. No double-dispose or leak. - ANSI/duration normalization (
NormalizeConsoleOutput): strips\u001b\[[0-9;]*mSGR sequences and blank lines from captured native-process output before assertions — reasonable and consistent with the "ANSI SGR/reset-only normalization" scope item, and doesn't hardcode any\d+msduration pattern. - JSON extraction in
DotnetRun_HelpAndDiscoveryDescribeActualHost: now locates{...}boundaries in--list-tests jsonoutput beforeJsonDocument.Parse, guarding against leading diagnostic noise (e.g., fromDOTNET_CLI_CONTEXT_VERBOSE=1) that would otherwise break JSON parsing.Assert.IsGreaterThanOrEqualTo(0, jsonStart, ...)andAssert.IsGreaterThan(jsonStart, jsonEnd, ...)read a little unusually (first two args arelowerBound, valueperAssert.IsGreaterThan<T>(T lowerBound, T value, ...)), but the logic is correct: it assertsjsonStart >= 0andjsonEnd > jsonStart.
Pre-existing issue found, out of this PR's scope (FYI only — no action requested)
src/Platform/Microsoft.Testing.Extensions.PackagedApp/InternalAPI/InternalAPI.Unshipped.txt still contains unresolved <<<<<<</=======/>>>>>>> git conflict markers on this PR's base and head (confirmed identical on rel/4.5 and on this PR's head commit 08dcedb). This file is not part of this PR's diff, so it predates these commits and was already broken on rel/4.5 before this backport. Since PublicAPI/InternalAPI analyzers typically fail the build on malformed entries, this will likely break CI for this and any other PR touching Microsoft.Testing.Extensions.PackagedApp on rel/4.5 until fixed in a separate, focused commit (resolving to the IsInformationalRequest/BootstrapFileName/4-arg Configure overload shape that matches the already-resolved PackagedAppControllerArguments.cs in this PR). Flagging since it's directly adjacent to files this PR edits and will surface in the queued CI run mentioned in the PR description.
Verdict
No actionable findings within this PR's diff. The conflict resolution appears complete and self-consistent across the MSBuild targets/Program.cs/tests, the SDK-isolation fix is well-tested on both the acceptance and unit-test level, and localization catalogs are correctly de-duplicated. No inline comments were posted.
|
Final test-triage resolution — Azure Pipelines build 1629411 Analysis is final (completed aggregate build; Summary: Build All 6
Each failure is matched by a passing retry attempt for the identical test name/sourceFile family, confirming intended fail-then-pass probe behavior rather than flakiness or a regression. These are part of the retry-extension validation samples ( Conclusion: No actionable test-product failure, crash/hang, or duration regression found for this build. No issue created — per playbook, intentional-by-design probe outcomes don't meet the durable-defect threshold, and there is no earlier preliminary comment on this PR to supersede with a downgrade.
|
|
Servicing CI verification completed for head Azure build 1629411 completed successfully against this PR's merge SHA The actual application-model logs were read, not inferred from job status:
This supplements the local fresh-pack evidence in the PR description: 305 exact discovery/result matches, 303 passed and two existing non-Windows-only unit skips, including all 129 acceptance cases passing. Remote CI also exercised the classic/modern UWP runtime and WinApp CLI scenarios that were not selected locally. Intentional first-attempt retry failures remain expected probe artifacts; they are not hidden or reclassified as product success. Implementation commit: |
Backport merged #11828 (
26c2897b0c7f53f35337427b881019df3e8a42ae) torel/4.5, based on423f76885c25eb92da6699599bc66d3223e611e2. Servicing versions remain MSTest 4.5.2 / Microsoft.Testing.Platform 2.5.2. This is a draft for servicing review; nothing is merged and the original PR branch is untouched.Scope
MSBuildSDKsPath,MSBuildExtensionsPath, and x64 runtime root with the selected CLI while preserving shared NuGet, tooling, and diagnostic settings. Wire native MSTest and WinUI consumers to the shared acceptance helper; scope and restore the standalone probe's environment.DOTNET_CLI_CONTEXT_VERBOSE=1in native child tests. Preserve result/exit, selection, handshake/no-handshake, retry, launch-profile, and cleanup assertions.;mstestfilter registration. Retained native scenarios use the existing guarded cleanup helper.c6e36dd11^, and regenerate with the owningUpdateXlftarget. Final diffs only remove one duplicate source/target pair in each of 13 catalogs; no translations were hand-edited.PACKAGE.mdand its directly related WinUI guide. Both were byte-identical to the servicing base and caused first-head CI markdownlint failures; preserve the existing bootstrap/launch-profile/informational documentation. No optional headings are added.dotnet testand project-selected servicing TFM. Public sample package pins are unchanged. No absent VSTestBridge test fix, acceptance-guidance framework, or unrelated main features are imported.Commits:
7cc5ed6d998f1f4235691b4d9b04d8843d6c5642implements the backport and coupled build prerequisites;08dcedb19ef5780b3206a47a0b5ebeab7fe54c68removes only the coupled documentation merge artifacts.Local validation — final refreshed shipping layout
Fresh full Release build/pack from this isolated servicing checkout; no main-checkout or other-worktree shipping outputs were reused. The toolchain is SDK
12.0.100-alpha.1.26480.103. Acceptance projects targetnet11.0and ran on its bundled runtime withDOTNET_ROLL_FORWARD=Major. Real nested consumers use SDK 10.0.401 and aligned locally packed4.5.2-dev/2.5.2-devpackages. Acceptance fixtures use unique per-run NuGet caches and this checkout's configuration-matched local package feeds.The complete composed validation was repeated after repacking the repaired shipping readme:
Independent same-built-host JSON discovery was reconciled by exact UID against final TRX: 305 discovered/results, 303 passed, two existing non-Windows-only unit skips, no missing/extra IDs. Independently source-planned native method/data-row counts match all 40 discovered/executed cases. All 129 acceptance cases passed without skips. The two unit skips are
OnNonWindows_AuthorizesNothingEvenWithAlwaysModeandIsEnabledAsync_OnNonWindows_IsDisabledEvenForAPackagedLayoutAndAlwaysMode.Coverage includes selected-work/failure/zero-result, help/discovery/JSON/response-file, no-build/named-profile precedence, staging/clean, suppressed/incompatible launcher, custom executable, cancellation, multi-TFM exit aggregation, and MSTest-only filter-registration contracts. SDK provenance assertions check the SDK version plus actual MSBuild tools/extensions/SDK directories, not merely
dotnet --version.The standalone probe intentionally exits 1 for its existing coverage/composition boundary. Its actual 14-entry report was checked: 4 Verified (
filter-trx,hangdump,packagedapp,retry), 1 Partial (coverage succeeds but has zero covered sample lines), 6 Unavailable, 3 NotExercised. Unsupported extensions are not claimed to execute successfully.Additional checks passed: pipeline YAML parse plus retained selector/SDK10 environment assertions, targets XML, PowerShell probe syntax, C# UTF-8 BOM preservation, catalog source/placeholder correspondence, and
git diff --check.Evidence and limitations
artifacts\TestResults\Release\ServicingFinal\{MSTest,WinUI,Unit}; binlogs use the exact paths above. Actual WinUI/probe evidence remains underartifacts\log\Release\PackagedWinUI\...\extension-probes.MSTest.Sdk.4.5.2-dev.nupkg=c1db16d8bef9595dfbf4787c009314a749c231dcaa6d893931462cb395589694;Microsoft.Testing.Extensions.PackagedApp.MSBuild.2.5.2-dev.nupkg=d148ef14ceeb864518deb05a282fc38ecd26cacd7f2898682d65175e4a2fd73c.ArtifactsTestResultsDirproduced passing, exactly reconciled executions. No checks or diagnostics were disabled.Remote CI status
Head
08dcedb19ef5780b3206a47a0b5ebeab7fe54c68is pushed and this draft's head/base/body were read back. First-head lint's nine inherited merge-artifact errors were addressed by the second commit. New-head GitHub markdownlint, source BOM, and CLA checks passed. Azure build 1629394 is queued/not started at the latest inspection; remote build/app-model CI is not yet verified. A same-session follow-up is scheduled to retain servicing ownership through that result. This PR is not claimed merge-ready from local results alone.