TypeLoadException with Xaml Compilation in Android

Attempted to switch to Xaml compilation by adding "[XamlCompilation(XamlCompilationOptions.Compile)]" to my Xaml pages as described here: https://developer.xamarin.com/guides/xamarin-forms/xaml/xamlc/. However, doing this results in a TypeLoadException (in Debug) or a linker failure (in Release). In both cases it is occurring in InitializeComponent(), and it is looking for, but cannot find, Xamarin.Forms.Internals.ResourceLoader.

Only happens in Android, not UWP. (Can't test iOS)

What am I doing wrong?

Best Answer

Answers

  • ManojkumarMaliManojkumarMali USMember ✭✭✭

    Remove [XamlCompilation(XamlCompilationOptions.Compile)] and try to compile again.

  • NicholasBauerNicholasBauer USMember ✭✭

    @ManojkumarMali said:
    Remove [XamlCompilation(XamlCompilationOptions.Compile)] and try to compile again.

    Yes that allowed it to compile. But then I wouldn't be using XamlC.

    I did a clean and rebuild and it worked--though this was also on an emulator, whereas it was previously failing on a device. I'll have to try again on the device later to make sure.

  • NicholasBauerNicholasBauer USMember ✭✭

    It does appear to work now.

Sign In or Register to comment.