-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Remove GetTempPath copy #74159
Remove GetTempPath copy #74159
Conversation
This function was addedin 2016 when the compiler was still coming to terms with its server process model. At that time we discovered that the return for `Path.GetTempPath()` was different for different invocation of our build task. This happened when more complex builds changed environment variables that influenced temp directories. Part of our reaction was adding this function that gave us more control over how temporary paths could vary between builds. It let us have explicit control over the working directory. In the years since this change was made we've gotten a lot more mature in our model here: 1. `Path.GetTemPath` is banned in the compiler via analyzers 2. The server process model is established and we are much more rigorous with how environment variables, temp paths, etc ... are handled. As such this method serves very little purpose. It just makes our code different and harder to understand. As such we're removing it.
@roslyn-compiler PTAL |
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.
LGTM Thanks (iteration 1)
@@ -520,8 +520,7 @@ internal int ExecuteTool(string pathToTool, string responseFileCommands, string | |||
var requestId = getRequestId(); | |||
logger.Log($"Compilation request {requestId}, PathToTool={pathToTool}"); | |||
|
|||
string workingDirectory = CurrentDirectoryToUse(); | |||
string? tempDirectory = BuildServerConnection.GetTempPath(workingDirectory); | |||
string? tempDirectory = Path.GetTempPath(); |
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.
So in the case where $env:TEMP is a relative path, is there a need to resolve it against the "CurrentDirectoryToUse()" now?
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.
No. It's the job of GetTempPath
to ensure there is a valid path here.
Test jobs appear to be timing out |
This function was addedin 2016 when the compiler was still coming to terms with its server process model. At that time we discovered that the return for
Path.GetTempPath()
was different for different invocation of our build task. This happened when more complex builds changed environment variables that influenced temp directories.Part of our reaction was adding this function that gave us more control over how temporary paths could vary between builds. It let us have explicit control over the working directory.
In the years since this change was made we've gotten a lot more mature in our model here:
Path.GetTemPath
is banned in the compiler via analyzersAs such this method serves very little purpose. It just makes our code different and harder to understand. As such we're removing it.