Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

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;


  • 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.