Skip to content

Conversation

@drewnoakes
Copy link
Member

@drewnoakes drewnoakes commented Sep 1, 2025

The project data caches don't include any properties that start with underscores, as these are considered 'private' and are therefore ignored to save cache space. Having a rule that uses a private property means that the consumer will see different data depending upon whether it comes from MSBuild or from a cache. The difference in behaviour would very likely cause downstream problems, so we should disallow it.

Microsoft Reviewers: Open in CodeFlow

@nkolev92
Copy link
Contributor

nkolev92 commented Sep 2, 2025

Created #9748.

When that's merged, you can just delete the _RestorePackagePruningDefault prop special case.

The project data caches don't include any properties that start with underscores, as these are considered 'private' and are therefore ignored to save cache space. Having a rule that uses a private property means that the consumer will see different data depending upon whether it comes from MSBuild or from a cache. The difference in behaviour would very likely cause downstream problems, so we should disallow it.
@drewnoakes drewnoakes force-pushed the dev/drnoakes/prevent-private-properties-in-rules branch from bddea7a to 47437df Compare September 2, 2025 21:48
@drewnoakes
Copy link
Member Author

#9748 has now merged. I rebased this PR on main and removed the special case for that property.

@drewnoakes drewnoakes enabled auto-merge September 2, 2025 21:49
@drewnoakes drewnoakes merged commit 12741bd into dotnet:main Sep 2, 2025
5 checks passed
@drewnoakes drewnoakes deleted the dev/drnoakes/prevent-private-properties-in-rules branch September 2, 2025 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants