PCL - PreseveAttribute not working?

According to the linker documentation it should be possible to create an own PreserveAttribute for PCL projects.

Could anyone confirm if that is working? For us nothing changes when applying the custom attribute. We use following code for the attribute:

using System;

namespace RebuyApp.Common.Attributes
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Event | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Struct)]
    public class PreserveAttribute : Attribute
    {
        public bool AllMembers = true;
        public bool Conditional = false;
    }
}

Answers

  • adamkempadamkemp USInsider, Developer Group Leader mod

    Is your entire assembly being stripped? If there are no references to any code in your entire assembly then the entire assembly will be stripped from the build, and the linker never even sees it. See this bug. You have to refer to something in that assembly to force it to even be considered. Yes, this is annoying.

  • OtaMaresOtaMares DEMember ✭✭

    The assembly itself is not stripped because its the PCL part of the code, that would be impossible. :)

Sign In or Register to comment.