-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Change WriteCodeFragment task to create directory #8558
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
Forgind
left a comment
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!
| /// Bad file path | ||
| /// </summary> | ||
| [Fact] | ||
| [WindowsOnlyFact(additionalMessage: "No invalid characters on Unix.")] |
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.
Why did this test work on Unix before?
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.
It worked before because the path didn't exist. Now that we ensure that the path is created, the test fails because there is not an MSB3713 error as the test expects. 😀
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.
Ah, looks like 3713 is a very generic error for any failure after our initial validation. Makes sense, thanks!
|
Off-topic except that I saw the problem while working on this issue: msbuild/src/Build.UnitTests/Construction/SolutionProjectGenerator_Tests.cs Lines 261 to 262 in 4ffba3f
|
rainersigwald
left a comment
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.
Awesome, thanks!
Fixes #8516
Context
Setting an
OutputDirectorywhere the directory does not exist, and setting anOutputFilewould fail.(Setting an
OutputDirectorywhere the directory does not exist, and not providing anOutputFilevalue would succeed becauseFileUtilities.GetTemporaryFilecallsDirectory.CreateDirectory.)Changes Made
WriteCodeFragment_Tests.cs
CombineFileDirectoryAndDirectoryDoesNotExist(pairs withCombineFileDirectory)ToDirectoryAndDirectoryDoesNotExist(pairs withToDirectory)CreateTaskWriteCodeFragment.cs
FileUtilities.EnsureDirectoryExists.Testing
Added unit tests first and confirmed failure.
Ran all unit tests on Windows 11 and macOS 12 (Monterey).
Notes