IL2023: There is more than one return child element specified for a method in a custom attribute annotations file

Cause

A method has more than one return element specified. There can only be one return element when putting an attribute on the return parameter of a method.

Rule description

Custom attribute annotation files are used to instruct the trimmer to behave as if the specified item has a given attribute. Attribute annotations can only be used to add attributes that have effect on the trimmer behavior. All other attributes are ignored. Attributes added via attribute annotations only influence the trimmer behavior, and they are never added to the output assembly.

A method element has more than one return element specified. Trimmer only allows one attribute annotation on the return type of a given method.

Example

<!-- IL2023: There is more than one 'return' child element specified for method 'method' -->
<linker>
  <assembly fullname="MyAssembly">
    <type fullname="MyType">
      <method name="MyMethod">
        <return>
          <attribute fullname="FirstAttribute"/>
        </return>
        <return>
          <attribute fullname="SecondAttribute"/>
        </return>
      </method>
    </type>
  </assembly>
</linker>