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 all commits
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
19 changes: 10 additions & 9 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,17 +69,16 @@ 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);
SolutionCompilationStateChecksums? stateChecksums;

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

if (solutionState.TryGetStateChecksums(projectId, out stateChecksums))
await stateChecksums.FindAsync(solutionState, assetHint, remainingChecksumsToFind, result, cancellationToken).ConfigureAwait(false);
}
Contract.ThrowIfNull(stateChecksums);

await stateChecksums.FindAsync(solutionState, assetHint, remainingChecksumsToFind, result, cancellationToken).ConfigureAwait(false);
}

public TestAccessor GetTestAccessor()
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