Skip to content
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

Update ProjectWorkspaceState and HostProject at the same time #11191

Merged
merged 3 commits into from
Nov 12, 2024

Conversation

davidwengier
Copy link
Contributor

Preparation for ongoing work to hook up the Roslyn tokenizer and #11182 I suppose.

There were three places that UpdateProjectWorkspaceState was called:

  1. In RazorProjectService, just before calling UpdateProjectConfiguration
  2. In ProjectWorkspaceStateGenerator, where we will need to add a call to UpdateProjectConfiguration in future, to wire up the tokenizer
  3. In our LiveShare bits, in response to events from the above.

Previous attempts to plumb through more things for RazorConfiguration resulted in RPS failures, that appeared to be simply more compilations of closed files. This makes sense because we were adding another update, which would have triggered another set of ProjectChanged events. I thought it would make more sense to combine these two updates together, so no matter which part of the project was being updated, there could be a single ProjectChanged notification. This is that.

@davidwengier davidwengier requested a review from a team as a code owner November 11, 2024 03:05
@davidwengier
Copy link
Contributor Author

Do not be put off by the integration test failures, the tests that failed are currently having a little flakiness moment.

Copy link
Member

@DustinCampbell DustinCampbell left a 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. I'm unsure about the two failing integration tests though.

Comment on lines 379 to 380
else if (currentConfiguration.Equals(configuration) &&
currentRootNamespace == rootNamespace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't RazorConfiguration is a record? If so, it should be equivalent to use ==.

Suggested change
else if (currentConfiguration.Equals(configuration) &&
currentRootNamespace == rootNamespace)
else if (currentConfiguration == configuration &&
currentRootNamespace == rootNamespace)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. Paranoia because ProjectWorkspaceState isn't a record, yet we had code that did == and .Equals and I deleted one of the checks, but it was the wrong one. Looking forward to fixing ProjectWorkspaceState in future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got a few branches with ProjectWorkspaceState converted to a record that I'm hoping to resurrect.

@davidwengier davidwengier merged commit 95f862d into main Nov 12, 2024
12 checks passed
@davidwengier davidwengier deleted the dev/dawengie/OneProjectUpdateToRuleThemAll branch November 12, 2024 02:43
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Nov 12, 2024
davidwengier added a commit that referenced this pull request Nov 14, 2024
Follow up to #11191 which caused RPS
regressions.

There were some edge-y things I papered over in that PR, assuming they
were unnecessary over-complications, but given the RPS regression I had
a closer look, and they could have caused re-compilation of closed
documents when only tag helpers changed, which would be new behaviour.
Not _entirely_ convinced the re-compilation is all unnecessary (if a
document used a Tag Helper that has only just been discovered, then its
code gen would legitimately change) but it's hard to justify when I
can't point to any tooling for the closed files that would actually
benefit from the extra work.

The key thing is not changing `DocumentCollectionVersion` when only
`ProjectWorkspaceState` changes. Not re-calculating import documents was
just a little extra amuse-bouche, and not caching the computed state
tracker is pure paranoia.
@jjonescz jjonescz modified the milestones: Next, 17.13 P2 Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants