Link assemblies PCL

NormanPaniaguaNormanPaniagua PYMember ✭✭
edited January 2015 in Cross Platform with Xamarin

Hi, I've a issue with PCL libraries, my library has some files like:

namespace Model
{
    public class Log : Collection<Log>
    {
        public string log { get; set; }
    }
}

Seems that the link assembler remove the constructor because I'm using reflection, I cannot use [Persist] or [Persistence] in android because this is a PCL lib.

Tried to add

        #pragma warning disable 0219, 0649
        public class Log : Collection<Log>
        {
                // some code
        }
        #pragma warning restore 0219, 0649

I tried to hack it adding a static method that calls the constructor but seems that still not working

                static void Hack () {
            new Log ();
        }

If I use Link SDK assemblies got another error (android related, see here)

How can I solve this issue?

Regards

Posts

  • adamkempadamkemp USInsider, Developer Group Leader mod

    You can use an XML file to control the linker if preserve attributes won't work: http://developer.xamarin.com/guides/cross-platform/advanced/custom_linking/

    This is a good reason why the Preserve attribute should not be in platform-specific namespaces, though.

  • NormanPaniaguaNormanPaniagua PYMember ✭✭

    Thanks, I would check it out the docs and lets see what happen, but seems that this will work.

    Regards

  • NormanPaniaguaNormanPaniagua PYMember ✭✭
    edited January 2015

    I just ended up using Android Link Skip, have no understand well how to use the custom linking, for iOS will see if is necessary to me to build the app, in this case will search more about custom linking.

Sign In or Register to comment.