IL2001: Descriptor file tried to preserve fields on type that has no fields
Cause
An XML descriptor file is trying to preserve fields on a type with no fields.
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="fields" />
</assembly>
</linker>
// IL2001: Type 'TestType' has no fields to preserve
class TestType
{
void OnlyMethod() {}
}
الملاحظات
إرسال الملاحظات وعرضها المتعلقة بـ