-
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
Make diagnostic checksum computation into an extension method. #77277
base: main
Are you sure you want to change the base?
Conversation
@jasonmalinowski @dibarbet this is ready for review. |
Is the motivation for this just to simplify the implementation? |
return _lazyDependentChecksum.GetValueAsync(cancellationToken); | ||
} | ||
|
||
private async Task<Checksum> ComputeDependentChecksumAsync(SolutionCompilationState compilationState, CancellationToken cancellationToken) |
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.
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.
Correct. But I don't think the complexity is worth it. Having the new system operate uniformly on any Project instance is more desirable for me.
// Calculate a checksum this project and for each dependent project that could affect semantics for this | ||
// project. We order the projects guid so that we are resilient to the underlying in-memory graph structure | ||
// changing this arbitrarily. | ||
foreach (var projectRef in project.ProjectReferences.OrderBy(r => r.ProjectId.Id)) |
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.
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.
We shouldn't have any repeats afaict.
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.
Note: an the expensive checksumming will be cached (at the ProjectState level). All this is doing is mixing the checksums together to make the final checksum.
We honestly could even consider not caching this. I was a bit nervous about going that much, in case of LSP where we might have N requests on the same Project.
@@ -21,6 +22,8 @@ namespace Microsoft.CodeAnalysis.Diagnostics; | |||
|
|||
internal static partial class Extensions | |||
{ | |||
private static readonly ConditionalWeakTable<Project, AsyncLazy<Checksum>> s_projectToDiagnosticChecksum = new(); |
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.
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 I didn't think there would be an issue with cwt here given how few keys there would be.
We can definitely run speedometer to see if there are concerns here
That's a large part yes. Also, to not depend as much on internal data which is easier to get wrong. |
Kicked off pipeline. |
No issues found. @ToddGrun ptal. |
Pipeline: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=11052330&view=results