[1.7-stable] Fix: DeploymentManager failing with error package downgrade#6125
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Please update the description with info about the issue (not the autogenerated AI slop template) |
|
If Add|Stage|Register try to downgrade a package (e.g add v4 when v5 is present) they return HRESULT_FROM_WIN32(ERROR_INSTALL_PACKAGE_DOWNGRADE). Why not check for that and treat it as Success? e.g. DeploymentManager.cpp line 393+ This is how PackageManager should have behaved but it was created in Win8 and VersionSupercedence behavior wasn't introduced until TH1, so for compat reasons PackageManager continues to return ERROR_INSTALL_PACKAGE_DOWNGRADE. Same reason that's additional information that should (by today's standards) be communicated via an [out] parameter but that would be a breaking change, so for compat reasons we continue returning the not-an-error HRESULT. PackageDeploymentManager handles this the right way per modern standards. Look for |
DrusTheAxe
left a comment
There was a problem hiding this comment.
See comment re ERROR_INSTALL_PACKAGE_DOWNGRADE
This was my first thought, we could just make it accept This fix makes the map to be correctly populated in every case. |
This reverts commit 37cb722.
Replicating #6021
On current telemetry on experimental builds, the majority of the failures on the deployment initialize method is due to ERROR_INSTALL_PACKAGE_DOWNGRADE.
This PR tracks one of the possible ways of that happening in the current code.
When we call
GetStatus()(either by itself or inside theInitialize()method), it tries to go over all the packages (Main and Singleton, in that order) and check if they are already installed or not (in the methodVerifyPackage()).The problem is that in the current way this is written, if the Main package is not installed in the machine, but the Singleton package is installed in a higher version, in the for loop, it will verify that Main is not installed and break from the loop. This break will make Singleton package not be verified, and it will not be added to the global map that tracks the versions of the currently installed packages.
Then, on the
AddOrRegisterPackages()method in the Deploy stage, we will try to install both packages. But as Singleton was not added to theg_existingTargetPackagesIfHigherVersionmap because of the early break, it will attempt to install it when a higher version is already installed.A microsoft employee must use /azp run to validate using the pipelines below.
WARNING:
Comments made by azure-pipelines bot maybe inaccurate.
Please see pipeline link to verify that the build is being ran.
For status checks on the main branch, please use TransportPackage-Foundation-PR
(https://microsoft.visualstudio.com/ProjectReunion/_build?definitionId=81063&_a=summary)
and run the build against your PR branch with the default parameters.