fix: Ensure errors when extracting nuget package or installing plugin don't leave behind incomplete files. #1428
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.
Whilst I was testing my new plugin I experienced an error during the NuGet package extraction. It was because of paths that were too long. (This is not XrmToolbox specific and I have resolved it).
I noticed after the error, that the partially extracted folder in the
NugetPackagesfolder was still present, and when I attempted the install again, the logic treated it as though it was successfully extracted - copying from there topluginsbut with incomplete content. This caused the plugin to appear installed, but not work due to the missing files.This PR adds some clean up in various places in case there's any IO error like the one I found. It ensures the partial folders get removed, so if the user retries, it will try again fully and not take incomplete files.
This PR was AI-assisted, but I have reviewed, revised and tested it with the version of my plugin that caused this error and observed that it corrects the behaviour.