IL2022: Could not find matching constructor for custom attribute specified in custom attribute annotations file

Cause

The constructor of a custom attribute specified in a custom attribute annotations file could not be found.

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 an 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 value passed to an argument child of an attribute element could not be converted by the trimmer to a type matching the attribute's constructor argument type.

Example

<!-- IL2022: Could not find matching constructor for custom attribute 'attribute-type' arguments -->
<linker>
  <assembly fullname="MyAssembly">
    <type fullname="MyType">
      <attribute fullname="AttributeWithNoParametersAttribute">
        <argument>ExtraArgumentValue</argument>
      </attribute>
    </type>
  </assembly>
</linker>