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

Use the project cone information in Scope.FindAssetsAsync #72509

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/Workspaces/Remote/Core/SolutionAssetStorage.Scope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ internal partial class SolutionAssetStorage
internal sealed partial class Scope(
SolutionAssetStorage storage,
Checksum solutionChecksum,
ProjectId? projectId,
SolutionCompilationState compilationState) : IDisposable
{
private readonly SolutionAssetStorage _storage = storage;

public readonly Checksum SolutionChecksum = solutionChecksum;
public readonly ProjectId? ProjectId = projectId;
public readonly SolutionCompilationState CompilationState = compilationState;

/// <summary>
Expand Down Expand Up @@ -67,15 +69,14 @@ private async Task FindAssetsAsync(
AssetHint assetHint, HashSet<Checksum> remainingChecksumsToFind, Dictionary<Checksum, object> result, CancellationToken cancellationToken)
{
var solutionState = this.CompilationState;
if (solutionState.TryGetStateChecksums(out var stateChecksums))
await stateChecksums.FindAsync(solutionState, assetHint, remainingChecksumsToFind, result, cancellationToken).ConfigureAwait(false);

foreach (var projectId in solutionState.SolutionState.ProjectIds)
if (ProjectId is null)
{
if (remainingChecksumsToFind.Count == 0)
break;

if (solutionState.TryGetStateChecksums(projectId, out stateChecksums))
if (solutionState.TryGetStateChecksums(out var stateChecksums))
Copy link
Member

Choose a reason for hiding this comment

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

instead of TryGet just get the checksums. Or use TryGet, but contract-call that it must succeed. (Same as below).

await stateChecksums.FindAsync(solutionState, assetHint, remainingChecksumsToFind, result, cancellationToken).ConfigureAwait(false);
}
else
{
if (solutionState.TryGetStateChecksums(ProjectId, out var stateChecksums))
await stateChecksums.FindAsync(solutionState, assetHint, remainingChecksumsToFind, result, cancellationToken).ConfigureAwait(false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Workspaces/Remote/Core/SolutionAssetStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public async ValueTask<Scope> StoreAssetsAsync(SolutionCompilationState compilat
return scope;
}

scope = new Scope(this, checksum, compilationState);
scope = new Scope(this, checksum, projectId, compilationState);
_checksumToScope[checksum] = scope;
return scope;
}
Expand Down
Loading