Skip to content

Issue #2257 Ensure Valid Wix Version File #2259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

tcs-devel
Copy link

This PR fixes #2257

Note 1: The first commit would also fix the issue but does not the IFileStream as an abstraction layer. The second commit does.

Note 2: The added unit test also succeeds without the fix :(. As far as I saw, this is because the OpenWrite() function of the TestFileSystem class does not behave the way as it documented in https://docs.microsoft.com/en-us/dotnet/api/system.io.file.openwrite?view=netcore-3.1 in regards to existing files.

@@ -35,6 +35,7 @@ public void Execute(VersionVariables variables, WixVersionContext context)
var root = doc.DocumentElement;
doc.InsertBefore(xmlDecl, root);

fileSystem.Delete(wixVersionFile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this always be deleted, unconditionally?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say yes, as the entire file is fully re-created (no update). This way it is ensured that the written file does not contain garbage after the expected content.
Maybe one could check whether the file exists, which is in my opinion useless as Delete() does not throw when the file does not exist.

Copy link
Member

@asbjornu asbjornu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all tests pass and the number of tests increases with this PR, I don't see why it shouldn't be merged. :)

@asbjornu asbjornu merged commit c6d8764 into GitTools:master May 8, 2020
@asbjornu
Copy link
Member

asbjornu commented May 8, 2020

Thanks for your contributions, @tcs-devel! 🙏

@asbjornu asbjornu added this to the 5.3.x milestone May 8, 2020
@arturcic arturcic modified the milestones: 5.3.x, 5.3.3 May 12, 2020
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.

[Bug] /updatewixversionfile does not cleanly recreate the file
4 participants