IL2045: Custom attribute is referenced in code but the trimmer was instructed to remove all of its instances
Cause
The trimmer was instructed to remove all instances of a custom attribute but kept its type as part of its analysis. This will likely result in breaking the code where the custom attribute's type is being used.
Example
<linker>
<assembly fullname="MyAssembly">
<type fullname="MyAttribute">
<attribute internal="RemoveAttributeInstances"/>
</type>
</assembly>
</linker>
// This attribute instance will be removed
[MyAttribute]
class MyType
{
}
public void TestMethod()
{
// IL2045 for 'MyAttribute' reference
typeof(MyType).GetCustomAttributes(typeof(MyAttribute), false);
}
Povratne informacije
Pošalјite i prikažite povratne informacije za