Skip to content

Fix RestoreTask tallying of written files#785

Merged
phil-allen-msft merged 2 commits intoaspnet:mainfrom
jimmylewis:newnullref
Mar 21, 2025
Merged

Fix RestoreTask tallying of written files#785
phil-allen-msft merged 2 commits intoaspnet:mainfrom
jimmylewis:newnullref

Conversation

@jimmylewis
Copy link
Copy Markdown
Contributor

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:
image

Resolves #784

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 phil-allen-msft merged commit 33c04f7 into aspnet:main Mar 21, 2025
2 checks passed
@jimmylewis jimmylewis deleted the newnullref branch March 21, 2025 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullReferenceException with latest version 3.0.67

2 participants