Bug 41627 - [Cycle 7] Xamarin.Android targets lead to ignorable ReSharper error in VS 2013: "Module 'Java.Interop...' should be referenced"
Summary: [Cycle 7] Xamarin.Android targets lead to ignorable ReSharper error in VS 201...
Status: RESOLVED UPSTREAM
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.1.0 (C7)
Hardware: PC Windows
: --- normal
Target Milestone: 4.1.3 (C7SR2)
Assignee: Bugzilla
URL:
: 40476 ()
Depends on:
Blocks:
 
Reported: 2016-06-08 23:45 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-08-04 13:10 UTC (History)
7 users (show)

Tags: BZRC7S1_C6SR4S1
Is this bug a regression?: ---
Last known good build:

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 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:
Status:
RESOLVED UPSTREAM

Description Brendan Zagaeski (Xamarin Team, assistant) 2016-06-08 23:45:29 UTC
[Cycle 7] Xamarin.Android targets lead to ReSharper error in VS 2013: "Module 'Java.Interop...' should be referenced"


The dependencies on `Java.Interop` and `System.Runtime` in the Cycle 7 version of Xamarin.Android are interesting / special:

> The current Xamarin.Android targets files auto-add Java.Interop and
> System.Runtime to the @(Reference) collection


In VS 2013 (but not VS 2015), this trips up ReSharper's analysis of the project dependencies, leading to an ignorable error message.




## Regression status: "regression" in Cycle 7

Although this is technically a change in behavior compared to Xamarin Cycle 6, it is also only a regression in the very specific context of ReSharper.  It's possible that there's an upstream bug or limitation in ReSharper itself where it doesn't properly interpret the slightly more advanced technique used by the new Xamarin.Android targets.

Since the issue does not seem to affect VS 2015 and higher, it might be acceptable to resolve this as a known limitation of older ReSharper in older VS versions, with a workaround.




## Possible workarounds

(a) Disable ReSharper.

or

(b) Explicitly add references to both `Java.Interop` and `System.Runtime` in the Android project.




## Steps to replicate

1. Enable ReSharper in Visual Studio 2013.

2. Create a new "Visual C# > Android > Blank App (Android)" project.

3. Wait for ReSharper to finish analyzing the project.

4. Open "ReSharper > Windows > Solution Errors".




## Results

ReSharper's "Solution Errors" window shows several errors about a missing reference to `Java.Interop`:

> TestApp\MainActivity.cs:12 Module 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' should be referenced


This error does _not_ affect the build process since the build process successfully auto-adds the `Java.Interop` and `System.Runtime` dependencies.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-06-08 23:51:03 UTC
*** Bug 40476 has been marked as a duplicate of this bug. ***
Comment 2 James Alt 2016-06-14 16:09:39 UTC
This also affects VS2015 with older versions of ReSharper installed. Currently running 2015 with ReSharper 9.1.3 and having the same issue.
Comment 3 Marco 2016-07-12 14:55:37 UTC
I have VS2015 and Resharper 2016.1.2 (the latest one) and after upgrading Xamarin to the Cycle 7 I have the same problem.
Comment 4 Joaquin Jares 2016-08-04 13:10:27 UTC
After discussing with ReSharper we decided to close this as External. Supporting twit (which doesn't really say much): https://twitter.com/kzu/status/760565188319993856