dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.21k stars 1.35k forks source link

[Bug]: IEventSource3.IncludeTaskInputs() doesnt actually include Task Input events #9804

Open baronfel opened 6 months ago

baronfel commented 6 months ago

Issue Description

In the use-sourceroot-for-relative-paths branch I'm working on extending Terminal Logger to read the SourceRoot items in the build to discover the current git repo, if any. This is done by

a) opting in to Task Input events b) reacting to the TaskParameterEventArgs events

However, the opt-in from IEventSource3.IncludeTaskInputs() isn't causing the events to be fired.

Steps to Reproduce

Expected Behavior

TaskParameterEventArgs events should be sent to the logger

Actual Behavior

No TaskParameterEventArgs events are fired

Analysis

Per @ladipro, LoggingService.IncludeTaskInputs is not plumbed to interact with BuildParameters.LogTaskInputs.

Versions & Configurations

No response

AR-May commented 6 months ago

@ladipro could you please comment if we need to change this behavior?

ladipro commented 6 months ago

@AR-May I still think it would be good to fix this. It looks like the original change in #3253 made us log task inputs if at least one logger requested it, but it was done only for VS. Basically, we need the equivalent of this code to exist on the code path where we do CLI builds:

https://github.com/dotnet/msbuild/blob/8526e850a54170457000221aafb36236a7077062/src/Build/Instance/ProjectInstance.cs#L2488-L2494

Though, if it's not blocking for @baronfel, I guess it can be parked in backlog

baronfel commented 6 months ago

Yes, this is a correctness/completion fix - if I had this I would be able to more accurately implement my change.. right now I'm having to use a heuristic, but I'd really rather be able to get the outputs from a specific Task.