Bug 44581 - View Model Properties cannot be found during Xaml binding
Summary: View Model Properties cannot be found during Xaml binding
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-09-21 15:35 UTC by Roman Rozinov
Modified: 2017-06-28 16:11 UTC (History)
5 users (show)

Tags: android build xaml binding
Is this bug a regression?: ---
Last known good build:

TestApp project to reproduce the issue. (236.25 KB, application/x-zip-compressed)
2016-09-21 16:15 UTC, Roman Rozinov

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Roman Rozinov 2016-09-21 15:35:44 UTC
I have upgraded to Xamarin.Android as part of the Xamarin update v4.2.0.680 Cycle 8 release.

I have a Solution with PCL project with simple Xaml MainPage and a bound ViewModel object that i attempt to bind a property to the Xaml label element.

In Android Options under Project settings, it is set to "Bundle assemblies to native code" and under Linker it is checked to "Sdk And User Assemblies"

After deploying, I am not seeing that the Property value of the model showing up in the view.  Logcat shows this error:
Error Message showing that Xaml Binding did not succeed to the underlying view model's binding context object.
I/mono-stdout( 2843): Binding: 'SampleText' property not found on 'TestApp.PCL.ViewModel.MainPageViewModel', target property: 'Xamarin.Forms.Label.Text'

Same code base works just fine when switching back to "Use Shared Runtime".

I would expect this to work regardless.

PS: I am using VS2015 with Update 3 and all regular extension updates to date.

Thank you,

Comment 1 Roman Rozinov 2016-09-21 16:15:11 UTC
Created attachment 17646 [details]
TestApp project to reproduce the issue.
Comment 2 Roman Rozinov 2016-09-22 19:05:33 UTC
After further testing, I have narrowed down the project properties which are causing this issue.
Under Android Options:
* Unselect "Use Shared Runtime"
* Select "Bundle assemblies into native code"
* Linker Options: Select either None or "SDK and User Assemblies"

If I select "SDK only" it appears that the issue does NOT occur.  I would love to be able to troubleshoot that further but unsure how to generate more logs.
Comment 3 David Ortinau [MSFT] 2017-06-28 16:11:43 UTC
I've tried reproducing this issue following those instructions and I'm not able to. If you are still experiencing this issue with the latest versions of Xamarin.Android and Xamarin.Forms, please reopen the issue with additional details.