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

Add two unit-tests for skipped targets with inputs but no outputs #7362

Open
KirillOsenkov opened this issue Feb 2, 2022 · 2 comments
Open
Assignees
Labels
Area: Engine Issues impacting the core execution of targets and tasks. Area: Logging Area: Tests triaged

Comments

@KirillOsenkov
Copy link
Member

KirillOsenkov commented Feb 2, 2022

Building this project results in logging a TaskParameterEventArgs with kind == SkippedTargetInputs, where itemType == null and Items == null:

<Project>

  <ItemGroup>
    <_CodesignItems Include="foo" />
  </ItemGroup>

  <Target Name="Build"
          Inputs="@(_CodesignItems)"
          Outputs="@(_CodesignItems -> '%(CodesignStampFile)')">
  </Target>

</Project>

image

This other case results in a friendlier message:

<Project>

  <Target Name="Build"
          Inputs="@(_CodesignItems)"
          Outputs="@(_CodesignItems -> '%(CodesignStampFile)')">
  </Target>

</Project>

image

The TaskParameterEventArgs is logged here:

The friendlier message is logged here:

_loggingService.LogComment(_buildEventContext, MessageImportance.Low,
"SkipTargetBecauseNoOutputsDetail");

We should add a couple of tests for the above scenarios and perhaps avoid logging both TaskParameterEventArgs if the item array is empty.

@KirillOsenkov
Copy link
Member Author

Originally reported in the viewer: KirillOsenkov/MSBuildStructuredLog#561

@KirillOsenkov
Copy link
Member Author

I have fixed the viewer to at least not crash with a NullReferenceException in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Engine Issues impacting the core execution of targets and tasks. Area: Logging Area: Tests triaged
Projects
None yet
Development

No branches or pull requests

4 participants