IL2002: Descriptor file tried to preserve methods on type that has no methods

Cause

An XML descriptor file is trying to preserve methods on a type with no methods.

Rule description

Descriptor files are used to direct the IL trimmer to always keep certain members in an assembly, regardless of whether the trimmer can find references to them. However, trying to preserve members that cannot be found will trigger a warning.

Example

<linker>
  <assembly fullname="test">
    <type fullname="TestType" preserve="methods" />
  </assembly>
</linker>
// IL2002: Type 'TestType' has no methods to preserve
struct TestType
{
    public int Number;
}