|Summary:||[Cycle 7, VS 2013 only] "'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel" for Android projects that reference PCLs that use `INotifyPropertyChanged`|
|Product:||Android||Reporter:||Brendan Zagaeski (Xamarin Team, assistant) <brendan.zagaeski>|
|Severity:||major||CC:||arpitj, brendan.zagaeski, luis.aguilera, mono-bugs+monodroid, narayanp, Rajneeshk|
|Target Milestone:||7.1 (C9)|
|Tags:||BZRC7S1_C6SR4S1, DefectEscapeReview_Done||Is this bug a regression?:||Yes|
|Last known good build:||XamarinVS 22.214.171.124 (a9c7826)|
|Attachments:||Diagnostic build output, detailed version info|
Description Brendan Zagaeski (Xamarin Team, assistant) 2016-06-09 17:37:49 UTC
Created attachment 16253 [details] Diagnostic build output, detailed version info [Cycle 7, VS 2013 only] "'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel" for Android projects that reference PCLs that use `INotifyPropertyChanged` ## Workaround Add a reference to `System.ObjectModel`  to the Android app project, as indicated by the error.  C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ObjectModel.dll (Note to the Xamarin engineering team: This doesn't feel like it should be the _intended_ way to fix the error for users moving forward because the "System.ObjectModel" facade assembly does not appear as an option in the graphical Reference Manager under "Project > Add Reference".) ## Regression status: regression in Cycle 7 that only affects the VS 2013 version of `msbuild` on Windows BAD: XamarinVS 126.96.36.1990 (2e39740) + VS 2013 GOOD: XamarinVS 188.8.131.52 (a9c7826) + VS 2013 GOOD: XamarinVS 184.108.40.2060 (2e39740) + VS 2015 GOOD: Xamarin.Android 220.127.116.11 (4e27558) on Mac ## Steps to replicate 1. Download the "XAML Samples" sample .  https://developer.xamarin.com/samples/xamarin-forms/XAMLSamples/ (Note: It is possible to replicate the problem in a new "Visual C# > Cross-Platform > Blank App (Xamarin.Forms Portable)" 2. Attempt to build the "XamlSamples.Android" project in the "Debug|Any CPU" configuration, using Visual Studio 2013 (or the corresponding version of `msbuild`) on Windows. ## BAD Results (on XamarinVS 18.104.22.1680) The build fails with an error: > The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. C:\source\XAMLSamples\XamlSamples\XamlSamples.Android\MainActivity.cs 26 13 XamlSamples.Android ## GOOD Results (on XamarinVS 126.96.36.199) The build completes without error. ## Additional version info (brief) Microsoft Visual Studio Professional 2013 Version 12.0.40629.00 Update 5 Windows 10 (64-bit)
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-06-09 18:21:07 UTC
One other potentially interesting comment about this issue: my VS 2013 test environment does have Microsoft Build Tools 2015 installed. I vaguely recall hearing something about some efforts to perhaps make it possible to use C# 6.0 features in Xamarin projects in VS 2013? If the intention was that all Xamarin builds (even in VS 2013) were supposed to start _requiring_ Microsoft Build Tools 2015, the fact that that is _not_ happening might be the overarching issue in this case.
Comment 2 dean.ellis 2016-06-10 11:51:06 UTC
Comparing the build outputs the CSC task in VS2013 is NOT being passed the System.ObjectModel.dll Facade assembly and the VS2015 is. The real question is why the different behaviour between the two systems.
Comment 3 dean.ellis 2016-06-10 13:53:55 UTC
The latest update makes use of Java.Interop which relies on System.Runtime.dll . However it seems that while VS2015 is great at auto picking up that fact VS2013 is not. The task RefolveAssemblyReference (according to the docs) does NOT set $(DependsOnSystemRuntime) when in the VS2013 tool chain. As a result none of our custom PCL Facades tasks were running. Adding the reference to System.ObjectModel.dll just hides the problem. If a different assembly was required you'd end up with and error for that too. The fix is to manually set $(DependsOnSystemRuntime) in our build targets. Since we relay on System.Runtime now anyway it should be have any impact.
Comment 4 dean.ellis 2016-06-10 17:46:59 UTC
Fixed in monodroid/cycle7/0b942506 and xamarin-android/master/eea35c8b
Comment 5 narayanp 2016-06-15 18:24:49 UTC
I am able to reproduce this issue with Xamarin.VisualStudio_188.8.131.520 and here is the build output for the same. Build Output: Gist: https://gist.github.com/Abhishekk360/36ce8863f5d1476c7f759f1c1a292a13 I have checked this issue with the Xamarin.VisualStudio_184.108.40.2063 and observed that now the issue is working fine as shown in the screencast. Screencast: http://www.screencast.com/t/uf204Ac46ata Build Output: Gist: https://gist.github.com/Abhishekk360/226cc0af79e80b263cb8fee9bce61c19 Environment Info: Gist: https://gist.github.com/Abhishekk360/573c291caf7ff7b79172d2fdf0de71fa
Comment 6 Arpit Jha 2016-06-17 13:10:26 UTC
I have checked this issue with C7SR0 build Xamarin.VisualStudio_220.127.116.114_3ae9e4f4330b98bda4844463c43a659f9214edbd and now its working fine. Screencast : http://www.screencast.com/t/i3g4ORtBflVX Environment Info: https://gist.github.com/Arpit360/8566d530f19c706c14bc220df3781f4b