-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Fix incremental builds #32860
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
Fix incremental builds #32860
Conversation
- Avoid writing to the obj directory unnecessarily to avoid tripping up the up-to-date check - Also fixes a subtle bug around file writing: File.OpenWrite will open an existing file and not truncate it, so if we ever write fewer bytes to that file than it currently contains, those additional bytes will be preserved, corrupting the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me; just add a bit of exception handling as noted in the comment.
Thanks for the contribution! |
Nudges towards the double negation in the FileMatch check With this @ajcvickers , fyi |
@AlmightyLks Good catch! |
File.OpenWrite
will open an existing file and not truncate it, so if we ever write fewer bytes to that file than it currently contains, those additional bytes will remain at the end, corrupting the file. UsingFile.Create
orFile.WriteAllBytes
ensures the contents of the files are fully replaced.I hope this passes the "not too clever" bar and also improves reliability and performance.
Fixes #32801