Hi all,
While investigating an issue with building the Android-version of our Xamarin.Forms App in VSTS (see here) I discovered a couple of surprising messages in the Android logcat, just prior to the App crashing (which is the original problem described in the former post). These messages all have the format of:
Binding: 'SourceProperty' property not found on 'MyModel', target property: 'TargetProperty'
Doing a little bit of searching, I came across some online discussions describing wrongly configured bindings. However, the bindings in our case do work as intended, and though SourceProperty
and TargetProperty
sometimes refer to child-controls included on a page that uses MyModel
as its view model, SourceProperty
always does exist in the model defined for the binding (sometimes this is MyModel
directly, at other times a separate binding context is passed as input to the custom control using a construct along the lines of {Binding ModelProperty, Source={x:Reference Self}}
.
The clearest example, however, is this message appearing on a page where the binding context is a view model that is instantiated in the constructor and assigned to BindingContext
prior to the call to InitializeComponent()
(for what it's worth it should be remarked that the view model is created and assigned in a base class with uses reflection to instantiate the view model and a generic type argument to determine the desired type of view model). In effect, this is such a plain case, that it surprises me to see a warning about it:
- Class constructor gets called.
- View model is instantiated and incorporates the property referred to in the warning with public accessibility.
- Binding context is set to view model.
InitializeComponent()
gets called.
Should I be concerned about these warnings? Could this cause the App to crash (referring back to my other question)? Why am I getting such warning messages if the first thing I do when creating the page is to set its binding context (and the binding context is null
) beforehand)? Is there a way to resolve these warnings?
Thanks for your help!
Best regards,
Alexander.