Skip to content

[Bug]: Wrong parameters in XslTransformation MSB3094 error when XmlInputPaths does not match OutputPaths #8641

Closed
@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

Issue Description

When the XslTransformation task is called such that the XmlInputPaths and OutputPaths parameters do not have the same number of items, it fails with an MSB3094 error that incorrectly references the XmlContent parameter.

Steps to Reproduce

Build this project:

<Project>
  <Target Name="Main">
    <XslTransformation XmlInputPaths="dummy.xml" XslInputPath="dummy.xslt" OutputPaths="" />
  </Target>
</Project>

(The dummy.xml and dummy.xslt files need not exist.)

Expected Behavior

error MSB3094: "OutputPaths" refers to 0 item(s), and "XmlInputPaths" refers to 1 item(s).
They must have the same number of items.

Actual Behavior

error MSB3094: "XmlContent" refers to 0 item(s), and "XmlInputPaths" refers to 1 item(s).
They must have the same number of items.

Analysis

// Check if OutputPath has same number of parameters as xmlInputPaths.
if (XmlInputPaths != null && XmlInputPaths.Length != _outputPaths.Length)
{
Log.LogErrorWithCodeFromResources("General.TwoVectorsMustHaveSameLength", _outputPaths.Length, XmlInputPaths.Length, "XmlContent", "XmlInputPaths");
return false;
}

The bug has been there ever since the first public commit.

Versions & Configurations

MSBuild 17.6.0-preview-23108-10+51df47643 from .NET SDK 8.0.100-preview.1.23115.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: LoggingArea: TasksIssues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll.bughelp wantedIssues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim.triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions