dotnet / dotnet/msbuild

Make it easier to track property value origin - log properties that were used for assignment

Open
#12,612 1 comment 1 reaction 0 assignees View on GitHub
backlog triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Summary

Request: log list of properties that went into calculating property. This will allow tooling to be enhanced to follow up the chain of assignments.

### Background and Motivation

Details:

There are awesome events like PropertyReassignmentEventArgs, PropertyInitialValueSetEventArgs, UninitializedPropertyReadEventArgs that are helpful with troubleshooting properties.

However, even with these it can be hard to follow the sequence assignments and condition checks that lead to assignment. For example, our overly customized build has something like this:

`$(MyObjectRoot)\$(MyFlatObjectPath)\$(_ProjectHash)\`

When some of these are also calculated, it gets hard to follow the chain manually.

Hence the request: log list of properties that went into calculating property. This will allow tooling to be enhanced to follow up the chain.

We should probably also log property generation id (that is increased on every assignment). This way if property is reassigned multiple times, we'd know exactly which generation was used.

### Proposed Feature

Put feature under additional flag in MsBuildLogPropertyTracking since it's even more expensive.

When enabled, this would add list of properties used in evaluation. Something like List>.
We should probably log not just events that did modify property but also ones that did not. When assignment condition is not met, developer could be troubleshooting "why is this not getting set" issue.

So feature shape could look like:
- Additional flag to enable feature
- Log generations of property (every change updates generation)
- Add PropertyNotAssignedEventArgs (for the cases when assignment was skipped due to false condition)
- Add list of properties that went into calculation (probably to base class of events?)

Should probably get feedback from current maintainers of log viewers if they see potential of adding visualization of property ancestry to the tool.

### Alternative Designs

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.