Fix RestoreTask tallying of written files#785
Merged
phil-allen-msft merged 2 commits intoaspnet:mainfrom Mar 21, 2025
Merged
Conversation
During the switch to using LibraryInstallationGoalState, we changed the behavior of taking a LibraryInstallationState and "updating" it to reflect the published files (this transform would expand the Files from globs to a full list). That's inherently done by GoalState now, which also takes into account the FileMappings, and produces a set of the destination files. This was somehow overlooked in this build task, which caused it to throw a NRE when it was looking at the LibraryInstallationState (now that it wasn't being "updated", the Files were empty in many cases). This fix re-computes each successful LibraryInstallationState into the LibraryInstallationGoalState, which contains the list of files that were installed by that library.
phil-allen-msft
approved these changes
Mar 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During the switch to using LibraryInstallationGoalState, we changed the behavior of taking a LibraryInstallationState and "updating" it to reflect the published files (this transform would expand the Files from globs to a full list). That's now done by LibraryInstallationGoalState, which also takes into account the FileMappings, and produces a set of the destination files.
This was somehow overlooked in this build task, which caused it to throw a NRE when it was looking at the LibraryInstallationState (now that it wasn't being "updated", the Files were null in many cases).
This fix re-computes each successful LibraryInstallationState into the LibraryInstallationGoalState, which contains the list of files that were installed by that library.
This isn't the ideal fix. I think it would be more natural for ILibraryOperationResult to be changed to contain the GoalState that was achieved (which does include the LibraryInstallationState that it was generated from, it's a superset of the current data). However, that's a messier change and this will address the NRE issues in the latest package.
Tested that this works and populates the collection as expected:

Resolves #784