-
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
Fix issue where output path set in construction never updated the project update state #74791
Conversation
…ution or project update state
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.
Approved assuming testing with razor with and without cs devkit
yup, seems to work in both cases |
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.
Can we add a test?
@@ -164,6 +163,10 @@ await ApplyChangeToWorkspaceAsync(w => | |||
onAfterUpdate: null); | |||
}).ConfigureAwait(false); | |||
|
|||
// Set this value early after solution is created so it is available to Razor. This will get updated |
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.
Not sure why Razor is being commented here -- this is just doing the thing the API is asking us to do....
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.
the early set was initially added for Razor here - 863962d
It does get set anyway later on when the cmdline is set.
src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProjectFactory.cs
Show resolved
Hide resolved
@@ -164,6 +163,10 @@ await ApplyChangeToWorkspaceAsync(w => | |||
onAfterUpdate: null); | |||
}).ConfigureAwait(false); | |||
|
|||
// Set this value early after solution is created so it is available to Razor. This will get updated | |||
// when the command line is set, but we want a non-null value to be available as soon as possible. | |||
project.CompilationOutputAssemblyFilePath = creationInfo.CompilationOutputAssemblyFilePath; |
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.
Could this have essentially been the only change needed here?
_projectUpdateState = _projectUpdateState.WithProjectOutputPath(creationInfo.CompilationOutputAssemblyFilePath, creationInfo.ProjectId);
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.
Possibly - but going through the same property setter as everything else feels safer.
Resolves dotnet/vscode-csharp#7402
863962d added support to set the backing field for
CompilationOutputAssemblyFilePath
when creating theProjectSystemProject
. This had an issue where the project update state ever observed this value as it did not go through appropriate setter onCompilationOutputAssemblyFilePath
which is responsible for updating that.This caused us to later throw exceptions when attempting to remove that path as there was nothing to remove in the project update state.
I updated the code to instead update the path immediately after the
ProjectSystemProject
(and the corresponding solution) was created, which resolves the issue on the test project linked in the issue.