Skip to content

Conversation

@dibarbet
Copy link
Member

@dibarbet dibarbet commented Aug 16, 2024

Resolves dotnet/vscode-csharp#7402

863962d added support to set the backing field for CompilationOutputAssemblyFilePath when creating the ProjectSystemProject. This had an issue where the project update state ever observed this value as it did not go through appropriate setter on CompilationOutputAssemblyFilePath 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.

@dibarbet dibarbet requested a review from a team as a code owner August 16, 2024 21:28
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 16, 2024
Copy link
Contributor

@ryzngard ryzngard left a 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

@dibarbet
Copy link
Member Author

Approved assuming testing with razor with and without cs devkit

yup, seems to work in both cases

Copy link
Member

@jasonmalinowski jasonmalinowski left a 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?

onAfterUpdate: null);
}).ConfigureAwait(false);

// Set this value early after solution is created so it is available to Razor. This will get updated
Copy link
Member

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....

Copy link
Member Author

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.

@dibarbet dibarbet changed the title Fix issue where output path set in construction never updated the solution Fix issue where output path set in construction never updated the project update state Aug 16, 2024

// 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;
Copy link
Member

@JoeRobich JoeRobich Aug 16, 2024

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);

Copy link
Member Author

@dibarbet dibarbet Aug 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LanguageServerProjectSystem Error while loading ...csproj

5 participants