Forum Xamarin.Forms
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.

Fix for XAMARIN Linker removing XAML referenced libraries?

I've got a Standard Library project in a Xamarin solution that produces XAML views. It references XAML controls that I built in a separate library. It crashes at runtime with:

Exception thrown: 'Xamarin.Forms.Xaml.XamlParseException' in Xamarin.Forms.Xaml.dll
Position 35:34. Type trcontrols:EmbeddedImageSource not found in xmlns clr-namespace:ThetaRex.Forms.Controls;assembly=ThetaRex.Forms

The designer has no problem finding this reference and will even complain when it isn't there. If I place a reference to the shared library in the initialization routine for the view, it works:

        public FolderView(FolderViewModel folderViewModel)
        {
            // Initialize the IDE maintained components.
            this.InitializeComponent();

            // Required to access this object in XAML.
            EmbeddedImageSource embeddedImageSource = new EmbeddedImageSource();

            // Provide a view model for the page.
            this.BindingContext = this.ViewModel = folderViewModel;
        }

But if I remove the line with the EmbeddedImageSource on it, I get the error again. I've found other posts which suggest that the assembly is optimized out of the referenced libraries if there's only XAML reference.

Anyone have a clue how to 1.) Report this? 2.) Work around it?

Tagged:

Answers

Sign In or Register to comment.