KirillOsenkov / MSBuildStructuredLog

A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.
MIT License
1.41k stars 188 forks source link

AfterTargets build reason not shown #762

Open JanKrivanek opened 4 months ago

JanKrivanek commented 4 months ago

Description

The AfterTagets build reason is not being shown:

image

msbuild.zip

This seems to be quite consistent so I guess it's probably not an unexpected bug? But for some reason I haven't found similar feature request here

KirillOsenkov commented 3 months ago

All we get is a ParentTarget, which is null for Target4: https://github.com/dotnet/msbuild/blob/cd64b7b4a690d809cf14fe2af807a328cce04e54/src/Framework/TargetStartedEventArgs.cs#L158

I'm guessing MSBuild should be setting ParentTarget to Target1 in this repro.

KirillOsenkov commented 3 months ago

And here's the logic that calculates the tooltip based on ParentTarget and TargetBuiltReason: https://github.com/KirillOsenkov/MSBuildStructuredLog/blob/4116c37b386613684c270893f2d0a606f82b465d/src/StructuredLogger/ObjectModel/Target.cs#L24-L47