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

Recognize direct properties access in ProjectInstance #10659

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

JanKrivanek
Copy link
Member

Fixes #10604

Context

MSBuildTreatWarningsAsErrors access was not recognized by PropertiesCheck - since it was bypassing Expander.

Changes Made

Added routing of properties access to ProjectInstance

Testing

Added unit test case specifically for MSBuildTreatWarningsAsErrors (fails without fix)

Notes

Not handling accesses via Project - as that would get much more involved and is specific for API calls and VS - which are both currently unsupported scenarios

Copy link
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

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

I think in my head I was envisioning this being a new wrapper around ProjectInstance.GetPropertyValue() that had tracking, used only in the parts of the engine that pay special attention to magic properties. Is that something you considered?

src/Build/Instance/ProjectInstance.cs Show resolved Hide resolved
@JanKrivanek
Copy link
Member Author

I think in my head I was envisioning this being a new wrapper around ProjectInstance.GetPropertyValue() that had tracking, used only in the parts of the engine that pay special attention to magic properties. Is that something you considered?

I thought about it, then dismissed it and now on the second thought I decided to follow it :-)

Originaly I wanted to have it more universal for cases where msbuild might be called through API (as prep for VS integration). However that will anyway need much more other work (especially as evaluation is separated) - so let's handle the case that is problematic now

@JanKrivanek JanKrivanek enabled auto-merge (squash) September 13, 2024 09:15
@JanKrivanek JanKrivanek merged commit 22fda7f into main Sep 13, 2024
10 checks passed
@JanKrivanek JanKrivanek deleted the proto/props-check-direct-access branch September 13, 2024 09:52
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.

Unused Property Check false positive - MSBuild special properties
4 participants