Bug 57147 - Intellisense for a class library project in same solution fails to load in Xamarin.Android
Summary: Intellisense for a class library project in same solution fails to load in Xa...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.5.0 (15.2)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-06-05 17:48 UTC by wadalo73
Modified: 2017-07-06 22:48 UTC (History)
6 users (show)

Is this bug a regression?: Yes
Last known good build: Visual Studio 15.2 (26430.06)

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:

Description wadalo73 2017-06-05 17:48:57 UTC
After updating to the 15.2 (26430.12) update of Visual Studio, I no longer have Intellisense or the ability to navigate to definition from C# files in my Xamarin.Android project to class libraries located in the same solution. 

The files for which Intellisense is now broken are in class library projects in the same solution as my Xamarin.Android project. These class library projects are also included in other solutions that do not contain any Android projects, and Intellisense works normally in those solutions. Intellisense also works within the class library projects themselves.

In the Xamarin.Android project files, Intellisense works to navigate to other files in the same project or System assemblies. Only references to classes defined in other projects in the same solution are broken. 

This issue does not occur in VS 15.2 26430.06. On the same machine, it doesn't happen in concurrent installations of Visual Studio 14.0 and VS 15.3 preview.

Bug occurs on:
Visual Studio 15.2 (26430.12) Enterprise
Xamarin version: (1be4f0c)
Xamarin.Android SDK: (9dbc4c5)
.NET Framework 4.6.01586

Bug does not occur on:
Visual Studio 15.3 (26510.0-Preview)
Visual Studio 14.0.25431.01 Update 3
Visual Studio 15.2 (26430.06)
Comment 1 Joaquin Jares 2017-06-16 19:32:32 UTC
Hi! It sounds like the background build for intellisense is either failing or taking too long. Does intellisense start working after a build? There's also a design time log you can send for verification. If you can do this and send the log, it would be super helpful: https://github.com/dotnet/project-system/blob/master/docs/design-time-builds.md#visual-studio-2017
Comment 2 wadalo73 2017-06-16 19:37:09 UTC
Thanks for your reply. I haven't had this problem since updating to VS 15.2 (26430.13) in conjunction with Xamarin If I do I will make sure to get a log.

When it was not working, it did not start working after a build. My workaround was to develop in 15.3 and build in 15.2 (since I was having unrelated build issues in 15.3 at the time).
Comment 3 Joaquin Jares 2017-06-19 13:45:32 UTC
Glad it does not happen anymore! I'm marking this issue as resolved, but please do reopen if you hit it again.
Comment 4 Jon Goldberger [MSFT] 2017-07-06 22:14:45 UTC
@Joaquin Jares 

I am still seeing this issue with Xamarin and VS 2017 Enterprise Version 15.2 (26430.15).

It happens with new projects from templates (Android and in the Android app of a Forms solution) on my end and building does not resolve the issue. (UPDATE: Building did resolve the issue one time, but not consistently, but that would still be a bug that should be addressed. One should not have to build for the intellisense to work and this is not necessary in Visual Studio for Mac)

Also this occurs in VS 2015 Enterprise Version 14.0.25431.01 Update 3 (and same Xamarin version 

## steps to reproduce 

1. Open VS 2017 or VS 2015 and create a new Android project (tested with Single View template)

2. Add a Android class library to the solution

3. Add a reference to the class library from the android app project.

4. Open MainActivity.cs and add a using statement to reference the new class library namespace.

Expected result: Auto-complete will offer the name of the class library namespace.

Actual result: Auto-complete does not offer the namespace for class library added in step 2. 

## Additional notes.

Build and deploy work fine. If I add a method to the default class in the class library, and call that method from OnCreate, it does run and return as expected, so this is just an intellisense/auto-complete issue. 

Once, and only once, I was able to resolve this issue by closing and re-opening the solution. Otherwise I was able to resolve this issue by adding a second Android app project to the solution and referencing the class library from that app project. Then intellisense/auto-complete also worked in the first app project.

Also might be worth noting that with an iOS app project and an iOS class library, all works as expected. Auto-complete and intellisense work as soon as the reference to the iOS lass library is add to the iSO app project, no build or any other actions are necessary. 

I tried to get the Design time build output using the steps outlined in https://github.com/dotnet/project-system/blob/master/docs/design-time-builds.md#visual-studio-2017 
but I did not get the Build - Design Time option in the output window. 

## Environment

Microsoft Visual Studio Enterprise 2017 
Version 15.2 (26430.15) Release
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Enterprise

Architecture Diagrams and Analysis Tools   00369-60000-00001-AA405
Microsoft Architecture Diagrams and Analysis Tools

Visual Basic 2017   00369-60000-00001-AA405
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA405
Microsoft Visual C# 2017

Visual C++ 2017   00369-60000-00001-AA405
Microsoft Visual C++ 2017

Visual F# 4.1   00369-60000-00001-AA405
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.6.00404.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30503.0
ASP.NET and Web Tools 2017

ASP.NET Web Frameworks and Tools 2012   4.0.11203.0
For additional information, visit https://www.asp.net/

ASP.NET Web Frameworks and Tools 2017   5.2.50303.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.30209.0
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.2.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Common Azure Tools   1.9
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

KofePackagePackage Extension   1.0
KofePackagePackage Visual Studio Extension Detailed Info

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure Hive Query Language Service   2.2.5000.0
Language service for Hive query

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50131.1

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   4.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

SQL Server Data Tools   15.1.61702.140
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript tools for Visual Studio

Visual C++ for Cross Platform Mobile Development (Android)   15.0.26228.00
Visual C++ for Cross Platform Mobile Development (Android)

Visual C++ for Cross Platform Mobile Development (iOS)   15.0.26228.00
Visual C++ for Cross Platform Mobile Development (iOS)

Visual Studio Tools for Universal Windows Apps   15.0.26430.06
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin (fec6f88)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK (9dbc4c5)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK (ad35de4)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 5 Jon Goldberger [MSFT] 2017-07-06 22:48:31 UTC
It was requested that I file a new bug report rather than re=-open this one.

New bug report: bug 57991

Setting to RESOLVED FIXED as it was before