Xamarin Forms: Public C# Properties Missing on Android

By in , , , , ,
No comments

While working on the mobile apps for McAllen Next (my new side project, stay tuned for more soon!), I discovered a very strange issue when running the app on Android; I kept getting repeated errors like this:

Binding: ‘IsLoading’ property not found on ‘RegionModel’, target property: ‘Xamarin.Forms.Label’

and as such, the UI would not bind and would render an empty label (or not at all, depending on the control).

At first I thought it was because the app wasn’t rebuilding properly, resulting in stale binaries as was suggested in a StackOverflow post I found while trying to find a fix.

Eventually I posted my own question about this issue and I swear before two minutes passed, I was provided the solution by a very helpful user Gusman.

Turns out I had the box checked in the Android properties for the project to link both SDK and User assemblies.

xamarin-forms-android-link-sdk-user-assemblies

Apparently this optimizes the selected assemblies, removing references to properties that the linker detects are not in use.

I don’t remember much from my college days when we built a compiler, but although optimization sounds great, completely deleting references is strange to me, especially if they’re going to be bound at runtime to the XAML as they are when working with Xamarin Forms…

But hey I’m not a compiler builder, so I changed the option to only link SDK assemblies, and everything is back to normal!

As always, I hope this is helpful, and thanks for reading!

The following two tabs change content below.

selaromdotnet

Senior Developer at iD Tech
Josh loves all things Microsoft and Windows, and develops solutions for Web, Desktop and Mobile using the .NET Framework, Azure, UWP and everything else in the Microsoft Stack. His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom. His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom.