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.22k stars 1.35k forks source link

Duplicate item transform in target Outputs should not be reported as Internal Error #4942

Open nxtn opened 4 years ago

nxtn commented 4 years ago

Steps to reproduce

<Project>

  <ItemGroup>
    <Item Include="$(MSBuildThisFile)" />
  </ItemGroup>

  <Target Name="_" Inputs="@(Item)" Outputs="@(Item->'%(Identity)');@(Item->'%(Identity)')" />

</Project>

Expected behavior

Project file error is reported.

Actual behavior

Internal error is reported.

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
Microsoft.Build.Shared.InternalErrorException: MSB0001: Internal MSBuild Error: ItemVectorPartition already contains a vector for items with the expression '@(Item->'%(Identity)')'
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args)
   at Microsoft.Build.BackEnd.TargetUpToDateChecker.SeparateItemVectorsFromDiscreteItems(SemiColonTokenizer items, ItemBucket bucket, Dictionary`2& itemVectors, Dictionary`2 itemVectorTransforms, Dictionary`2& discreteItems, ElementLocation elementLocation)
   at Microsoft.Build.BackEnd.TargetUpToDateChecker.ParseTargetInputOutputSpecifications(ItemBucket bucket, Dictionary`2& itemVectorsInTargetInputs, Dictionary`2& itemVectorTransformsInTargetInputs, Dictionary`2& discreteItemsInTargetInputs, Dictionary`2& itemVectorsInTargetOutputs, Dictionary`2& discreteItemsInTargetOutputs, List`1& targetOutputItemSpecs)
   at Microsoft.Build.BackEnd.TargetUpToDateChecker.PerformDependencyAnalysis(ItemBucket bucket, ItemDictionary`1& changedTargetInputs, ItemDictionary`1& upToDateTargetInputs)
   at Microsoft.Build.BackEnd.TargetEntry.ExecuteTarget(ITaskBuilder taskBuilder, BuildRequestEntry requestEntry, ProjectLoggingContext projectLoggingContext, CancellationToken cancellationToken)      
   at Microsoft.Build.BackEnd.TargetBuilder.ProcessTargetStack(ITaskBuilder taskBuilder)
   at Microsoft.Build.BackEnd.TargetBuilder.BuildTargets(ProjectLoggingContext loggingContext, BuildRequestEntry entry, IRequestBuilderCallback callback, String[] targetNames, Lookup baseLookup, CancellationToken cancellationToken)
   at Microsoft.Build.BackEnd.RequestBuilder.BuildProject()
   at Microsoft.Build.BackEnd.RequestBuilder.BuildAndReport()
   at Microsoft.Build.BackEnd.RequestBuilder.RequestThreadProc(Boolean setThreadParameters)

Environment data

Microsoft (R) Build Engine version 16.4.0-preview-19529-02+0c507a29b for .NET Core

rainersigwald commented 4 years ago

Thanks for the report!