Skip to content

DeepCopyFrom fails to copy metadata values that are structured xml #7435

@AArnott

Description

@AArnott

Issue Description

DeepCopyFrom fails to copy metadata values when those values are structured xml.

Steps to Reproduce

Given project xml such as this:

  <ItemGroup Label="OptProf Configuration">
    <OptProf Include="$(BaseOutputPath)\$(AssemblyName).dll">
      <Scenarios>
        <TestContainer Name="vside.IdeExp.GetToCodeTests">
        </TestContainer>
      </Scenarios>
    </OptProf>
  </ItemGroup>

Call ProjectItemElement.DeepCopyFrom and pass in the OptProf item.

Expected Behavior

The item is fully reproduced at the new location:

    <OptProf Include="$(BaseOutputPath)\$(AssemblyName).dll">
      <Scenarios>
        <TestContainer Name="vside.IdeExp.GetToCodeTests">
        </TestContainer>
      </Scenarios>
    </OptProf>

Actual Behavior

The xml content of the Scenarios metadata is omitted from the clone:

    <OptProf Include="$(BaseOutputPath)\$(AssemblyName).dll">
      <Scenarios />
    </OptProf>

Analysis

Other metadata (in the larger repro) does copy metadata values. The only one that is left empty is this, which uniquely contains xml.

Versions & Configurations

This is with MSBuild 17.2.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions