Bug 44535 - [Cycle 8, reversion of Bug 41665] "'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel" for projects that reference PCLs with `INotifyPropertyChanged`
Summary: [Cycle 8, reversion of Bug 41665] "'System.ComponentModel.INotifyPropertyChan...
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 7.0 (C8)
Hardware: PC Windows
: High major
Target Milestone: 7.0.1 (C8SR1)
Assignee: dean.ellis
: 44363 ()
Depends on:
Reported: 2016-09-20 18:32 UTC by Jimmy [MSFT]
Modified: 2016-10-19 19:36 UTC (History)
7 users (show)

Tags: BZRC8SR0B2_C7SR1S1
Is this bug a regression?: Yes
Last known good build: Cycle 7 SR 1

repro solution (39.68 KB, application/zip)
2016-09-20 18:32 UTC, Jimmy [MSFT]
Patched Xamarin.Android.Common.props for manual fix (359 bytes, text/plain)
2016-09-23 19:55 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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 Jimmy [MSFT] 2016-09-20 18:32:25 UTC
Created attachment 17618 [details]
repro solution

### Overview
Trying to build an Android project in VS2013 that references a PCL is resulting in 

> error CS0012: The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

This appears to be realted with PCLs because if the same class that implements 'INotifyPropertyChanged' is moved to the actual project, then it builds without error.

This sounds similar to bug 32425 however this new issue occurs in VS2013 instead of VS2015. This is also a regression in C8 as I tested with the previous C7 stable build and the error did not occur.

Version Info and build output: https://gist.github.com/jimmgarrido/d499a627dd77b3560485249c7554ac18

### Steps to Reproduce
1. Open the attached repro solution in VS2013
2. Build the Android project

### Expected Results
No build errors

### Actual Results
Build will fail with `error CS0012: The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'`
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-23 19:53:58 UTC
This is a reversion of Bug 41665.  The fix is for that bug needs to be included into the Cycle 8 branch.

The fix is a one line change in src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props:

That line is _missing_ in the Cycle 8 versions of Xamarin.Android (at least in the files installed by the Windows installer).

## Applying the fix manually (for users seeing this issue)

1. Download the attached file from the next comment, or save the following lines into a text file named Xamarin.Android.Common.props:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <DependsOnSystemRuntime Condition=" '$(DependsOnSystemRuntime)' == '' ">true</DependsOnSystemRuntime>

2. Copy the file to overwrite the existing old file:

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.props

Xamarin Customer Support
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-23 19:55:39 UTC
Created attachment 17721 [details]
Patched Xamarin.Android.Common.props for manual fix
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-23 20:06:20 UTC
*** Bug 44363 has been marked as a duplicate of this bug. ***
Comment 6 qijiang 2016-09-23 20:50:45 UTC
Hi Brendan,

After applying the manual fix, Android build issue resolved but still seeing the same exception when try to deploy to device. Is there some other places we need to apply the change as well?

Comment 7 qijiang 2016-09-23 21:06:45 UTC
Never mind. I switch back to use jdk1.7 and after turn on/off VS2013 several times, finally successfully deployed to device. Everything works fine now. Thanks for your help.
Comment 8 dean.ellis 2016-09-26 12:07:10 UTC

I pushed a fix for master in monodroid/master/00e753ee

We'll need to test that then we can cp over to cycle8
Comment 9 Naqeeb 2016-10-03 13:36:46 UTC
I have checked this issue with attached sample and observed that it is working fine. I am able to build sample successfully without ant error. Here is the screencast for the same: http://www.screencast.com/t/WXhZYxs7

Environment info: https://gist.github.com/NaqeebAnsari/9d5ca86f3e54b730f4bb2d132320db46

Hence closing this issue.
Comment 10 Michael van der Horst 2016-10-04 11:52:53 UTC
@Nageeb, that's because the issue occurs on VS2013, not on VS2015
Comment 11 Brendan Zagaeski (Xamarin Team, assistant) 2016-10-04 17:27:55 UTC
Naqeeb's test was using a build from Xamarin development "master" branch (c7ab7a6) that includes the fix from Comment 8.  That is just an internal test version, not something that has been published.

I'm not sure why Naqeeb attached the environment info from Visual Studio 2015 in the Gist.  The screencast can be seen to be VS 2013 by the fact that the menu labels are all-caps (and the version info screen shown at the end of the screencast).
Comment 12 Naqeeb 2016-10-17 10:58:49 UTC
I was check this issue with VS 2013 as given in screencast attached in comment 9, but by mistaken I was provide incorrect Environment info.
Comment 13 Naqeeb 2016-10-17 11:34:47 UTC
I have checked this issue with latest C8SR1 build i.e. Xamarin.VisualStudio_4.2.1.10_7dfd88ce14299e8598bc95fe6fdbf14d68e96211 in VS2013 and observed that it is working fine. Here is the screencast for the same: http://www.screencast.com/t/so976r3sAX8

Environment info: https://gist.github.com/NaqeebAnsari/24ac0332870608cb9ec619cbf3d09f2f