Skip to content

Conversation

@YuliiaKovalova
Copy link
Member

Fixes #9458

Context

The two build requests appear to be treated as identical by the results cache even when different BuildRequestDataFlags were provided .

Changes Made

Before returning cache results, check the cached BuildRequestDataFlags for the previous BuildResult.

Testing

Manual + UT

Copy link
Contributor

@Forgind Forgind left a comment

Choose a reason for hiding this comment

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

This seems like it should work, but it's also a big more aggressive than I think is necessary. Specifically, BuildRequestDataFlags have a number of options, some of which seem like they'd make it invalid to use the same result for another project but some of which seem like they wouldn't affect the result. Can we be more precise in this comparison than just a straight comparison?

Copy link
Member

@ladipro ladipro left a comment

Choose a reason for hiding this comment

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

I agree with @Forgind's comments.

@YuliiaKovalova YuliiaKovalova force-pushed the dev/ykovalova/fix_missed_ProjectStateAfterBuild branch from 677494e to 475e215 Compare January 2, 2024 09:46
@YuliiaKovalova YuliiaKovalova requested a review from ladipro January 2, 2024 10:18
Copy link
Member

@ladipro ladipro left a comment

Choose a reason for hiding this comment

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

I've left a few comments inline. I think we need to split BuildRequestDataFlags into those that affect the result and those that don't to make the right check in CheckBuildDataFlagsResults.

Also, please take a look at ProvideSubsetOfStateAfterBuild. This is similar to ProvideProjectStateAfterBuild but the returned state goes through a user-specified filter. If the filtered ProjectInstance is stored in the cache, we will likely need to use the filter (as defined in RequestedProjectState) as an additional cache key.

Copy link
Member

@rokonec rokonec left a comment

Choose a reason for hiding this comment

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

Had not found other defects than Ladi review.

@rokonec rokonec self-assigned this Jan 3, 2024
@YuliiaKovalova YuliiaKovalova requested a review from ladipro January 4, 2024 11:53
Copy link
Member

@ladipro ladipro left a comment

Choose a reason for hiding this comment

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

I've added a few minor comments. Please add an entry to the ChangeWave document.

@YuliiaKovalova YuliiaKovalova merged commit 69a76bb into dotnet:main Jan 5, 2024
ladipro added a commit that referenced this pull request Apr 19, 2024
Fixes #9458

### Context

#9565 had to be reverted because the assumption that results with `BuildRequestDataFlags.ProvideSubsetOfStateAfterBuild` don't have to be cached broke design-time builds in Visual Studio.

### Changes Made

Re-did the change, now with full handling of `BuildRequestDataFlags.ProvideSubsetOfStateAfterBuild`.

### Testing

New and existing unit tests, experimental insertion, manual testing with the problematic design-time build scenario.

### Notes

Compared to #9565, we now:
- Copy the flags from the original `BuildResult` in the `BuildResult` copy constructor.
- Have `ProjectInstance` remember the project state filter it was created from.
- Implement `IsSubsetOf` operator on `RequestedProjectState`.
- Use the `IsSubsetOf` to determine if a request with `ProvideSubsetOfStateAfterBuild` can be satisfied by the cache.
- Don't consider `SkipNonexistentTargets` to be a flag affecting build results.
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.

[Bug]: ResultsCache ignores some of the BuildRequest data, may return incorrect results

4 participants