Control working in debug on device and in simulator but not in Ad Hoc build

JoshuaNovakJoshuaNovak USMember ✭✭

I have a control a built using NControl for Xamarin forms. It works in debug on the device and the simulator, but when I do an ad hoc build and test it, the controls don't show up. Anyone have any ideas why that might happen?

Here is my control code:

using NControl.Abstractions;
using Xamarin.Forms;
using NGraphics;
using System.Diagnostics;
using System.Collections.Generic;

namespace MyApp.Controls
    public class HalfRibbon : NControlView
        public static BindableProperty EndPercentageProperty = 
            BindableProperty.Create<HalfRibbon, double> (p => p.EndPercentage, 0.07, 
                BindingMode.OneWay, null, EndPercentageChanged);

        public double EndPercentage 
            get { return (double)GetValue(EndPercentageProperty); }
            set { SetValue(EndPercentageProperty, value); }

        private static void EndPercentageChanged(BindableObject bindable, double oldValue, double newValue)
            (bindable as HalfRibbon).Invalidate();

        public static new BindableProperty BackgroundColorProperty = 
            BindableProperty.Create<HalfRibbon, Xamarin.Forms.Color> (
                p => p.BackgroundColor, Xamarin.Forms.Color.Transparent, BindingMode.OneWay, null, BackgroundColorChanged);

        public new Xamarin.Forms.Color BackgroundColor
            get { return (Xamarin.Forms.Color)GetValue(BackgroundColorProperty); }
            set { SetValue(BackgroundColorProperty, value); }

        private static void BackgroundColorChanged(BindableObject bindable, Xamarin.Forms.Color oldValue, Xamarin.Forms.Color newValue)
            (bindable as HalfRibbon).Invalidate();

        public HalfRibbon ()

        public override void Draw(NGraphics.ICanvas canvas, NGraphics.Rect rect)
            base.Draw(canvas, rect);

            var backgroundBrush = new SolidBrush(new NGraphics.Color(BackgroundColor.R,
                BackgroundColor.G, BackgroundColor.B, BackgroundColor.A));

            var width = (WidthRequest > 0)? WidthRequest : rect.Width;
            var ribbonWidth = Math.Ceiling(width * EndPercentage);
            var height = (HeightRequest > 0)? HeightRequest : rect.Height;

            canvas.DrawPath(new PathOp []{ 
                new MoveTo(0, 0),
                new LineTo(width, 0),
                new LineTo(width - ribbonWidth, height / 2),
                new LineTo(width, height),
                new LineTo(0, height),
                new LineTo(0, 0),
                new ClosePath()
            }, null, backgroundBrush);


  • JoshuaNovakJoshuaNovak USMember ✭✭

    Looks like this has to do with Linker Options. Once I set the Linker Options > Linker Behaviour to Don't link it worked. Not sure if this is a bug with NControl or Xamarin, or just needs to be put in the NControl docs.

  • XavyerXavyer MDMember ✭✭

    Have the same problem, was you able to find out what specific assembly needs to be skipped by linker for this to work?

  • DH_HA1DH_HA1 USMember ✭✭✭

    I am having the same problem? Any resolution on this?

  • JoshuaNovakJoshuaNovak USMember ✭✭

    What I posted works for me, I don't know which ones specifically need to be linked, but setting the Linker Behaviour to Don't link works for me.

Sign In or Register to comment.