Bug 30844 - Intellisense not working in Cross-Platform Android project
Summary: Intellisense not working in Cross-Platform Android project
Status: RESOLVED DUPLICATE of bug 50914
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 7.1 (C9)
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: dean.ellis
Depends on:
Reported: 2015-06-05 10:57 UTC by Keith Rodrigue
Modified: 2016-12-27 08:44 UTC (History)
13 users (show)

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

"Organize Usings" not appearing in Directive Context Menu (85.39 KB, image/jpeg)
2015-06-05 10:58 UTC, Keith Rodrigue
"Organize Usings" missing from Edit->Intellisense menu (90.97 KB, image/jpeg)
2015-06-05 11:00 UTC, Keith Rodrigue

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 Keith Rodrigue 2015-06-05 10:57:41 UTC
I have a Cross-Platform solution and for some reason Intellisense does not work, or it is very limited, in the Android project.  For example, when I right-click on my declarations, my “Organize Using’s” does not appear. (See attachment)  

Nor does it appear when I go to Edit->IntelliSense.

This is only an issue in the Android project.  The iOS project or PCL project does nto have this issue.  At random times, Intellisense works in the Android project, but once you restart VS, it's gone.

VS Version Info:

Microsoft Visual Studio Ultimate 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51650

Installed Version: Ultimate

Architecture and Modeling Tools   06181-004-0449004-02527
Microsoft Architecture and Modeling Tools
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2013   06181-004-0449004-02527
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06181-004-0449004-02527
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0449004-02527
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0449004-02527
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0449004-02527
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0449004-02527
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0449004-02527
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06181-004-0449004-02527
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.4.51016.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.21010.0
For additional information, visit http://www.asp.net/

AWS Toolkit for Visual Studio 2013
AWS Toolkit for Visual Studio 2013.
Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.

This software includes third party software subject to the following copyrights:
- Logging from log4net, Apache License 
- Putty for PPK to PEM conversion, MIT license 
- NGit for AWS Elastic Beanstalk incremental push
- NSch dependency for NGit
- Sharpen dependency for NGit
- ICSharpCode.SharpZipLib dependency for NGit
- Mono.Posix.dll and Mono.Security.dll dependencies for NGit
- MPFProj for Visual Studio Project Framework
- JSON Checker for JSON validation

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

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone

Microsoft Azure Mobile Services Tools   1.3
Microsoft Azure Mobile Services Tools

Microsoft Team Foundation Server 2013 Power Tools   12.0
Power Tools that extend the Team Foundation Server integration with Visual Studio.

Microsoft Visual Studio Process Editor   1.0
Process Editor for Microsoft Visual Studio Team Foundation Server

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

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.3
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.11.590.0 (5160db7)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (d419c934e6ce2113653ff4c40214e3a5d5a69440)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS (fce006eae308515fc1eaf85fcc0f90699d9c7e8b)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration

Xamarin Version Info:

Xamarin Studio
Version 5.9.2 (build 2)
Installation UUID: d84feb75-081d-4a27-9703-1b96743b047b
	Microsoft .NET 4.0.30319.34209
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

Version: 5.1.3 (Business Edition)
Android SDK: C:\Program Files (x86)\Android\android-sdk
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: C:\Program Files\Java\jdk1.8.0_31
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

Xamarin Android Player
Not Installed

Build Information
Release ID: 509020002
Git revision: 43735a4b905b571f69cf9428a3ea7b52aef55476
Build date: 2015-05-19 06:52:51-04
Xamarin addins: ab18ddff45f507ed74f36c2b65df9aee22e28a56

Operating System
Windows 6.2.9200.0 (64-bit)
Comment 1 Keith Rodrigue 2015-06-05 10:58:37 UTC
Created attachment 11480 [details]
"Organize Usings" not appearing in Directive Context Menu
Comment 2 Keith Rodrigue 2015-06-05 11:00:21 UTC
Created attachment 11481 [details]
"Organize Usings" missing from Edit->Intellisense menu
Comment 3 Keith Rodrigue 2015-06-05 11:25:57 UTC
Just confirmed this also happens in a brand-new clean Cross-Platform solution created from Xamarin Studio.  Create a new Cross-Platform solution in Xamarin Studio, Save Solution, open in Visual Studio, right-click on declarations in Xamarin.Android MainActivity.cs.
Comment 4 Jon Goldberger [MSFT] 2015-06-05 21:20:17 UTC
I have confirmed this also happens with a new Forms solution created from Visual Studio, but this did not occur when I opened an older Forms solution created on January 15, 2015. So it would seem to be an issue in the new templates?
Comment 5 Danish Akhtar 2015-06-10 03:26:48 UTC
We are also getting this issue with Cross-Platform solution created in VS for android project. However with iOS its working fine.

Screencast for the same: http://www.screencast.com/t/kESPzi2kkL
ide logs: https://gist.github.com/saurabh360/0374bcd54933663fdd1a

Hence marking this as Confirmed.

Environment info:
VS 2013
XVS 3.11.590
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2015-06-23 20:16:05 UTC
## Regression status: not an immediate regression

I was able to reproduce the problem on 3.9.547 as well as 3.11.590.

BAD: XamarinVS 3.9.547.0  (20fd2f0)
BAD: XamarinVS 3.11.590.0 (5160db7)

## Possible workaround

In some of my quick tests, it appeared that the following steps improved the chances that the Android project would behave as expected:

1. Build the Android app project.

2. Close and then re-open the solution.
Comment 7 Michael Rumpler 2016-03-15 10:21:41 UTC
I have this problem too for quite some time. In the past it did not happen very often, but unfortunately now it is very consistent. Probably also because I have to delete my .vs folder every day because of https://bugzilla.xamarin.com/show_bug.cgi?id=39034

Recently I tried with XVS, and All have the same problem.

What I recognized is, that the code editor does not seem to recognize the file type. In the top left dropdown list you usually see the project name, but I only have "Miscellaneous Files" there. You can also see that in Keiths screenshot https://bugzilla.xamarin.com/attachment.cgi?id=11480
Comment 8 Adam van den Hoven 2016-08-03 17:10:03 UTC
With reference to Comment 7, I wanted to add some additional information. I was getting the "Miscellaneous Files" project issue mentioned by Michael Rumpler and it was caused by a missing asset file (AndroidAsset build action). When I resolved the missing file issue, in my case by deleting the out of date reference, the problem resolved itself.
Comment 9 Joaquin Jares 2016-12-20 12:39:02 UTC
This does look like that issue. There's some supporting files we need to download for Android intellisense to work and it's kind of big, so it may take a little while. On old projects, the support should be there and that's why it would work on comment 4. I'm moving this to Android.
Comment 10 Juan Marcelo Tondato 2016-12-26 14:01:11 UTC
As we've added several improvements to our setup/build system mechanism since the bug was reported, I'm resolving it tentatively as Fixed.
I cannot reproduce it with current alpha bits.
That said, if you're still facing this issue with current alpha bits, please feel
free to reopen the bug.
Comment 11 Brendan Zagaeski (Xamarin Team, assistant) 2016-12-26 22:18:28 UTC
I suspect the attempt to replicate in Comment 10 did not try using an older version first to ensure that all of the necessary steps to replicate were followed.  In contrast to the results reported in Comment 10, I _am_ still able to replicate this issue on Cycle 9 Alpha.

## Verification status: not yet fixed as of the current Cycle 9 Alpha

BAD:  XamarinVS (0373883)  Cycle 9 Alpha              (December 19, 2016)
BAD:  XamarinVS  (872717c)  Cycle 8 Service Release 1  (November 22, 2016)

## Guess about underlying cause

This issue could all be tied to the fact that the Android project depends on the Android Support Library packages.  For example, maybe the problem is that the design-time build must _not_ download the m2repository because that long-running download task should only happen during a non-design-time build.

That said, the m2repository only contains Java types, so it is not _required_ for C# type resolution (or IntelliSense).  If the Android Support Libraries are indeed the crux of the problem on this bug, maybe it would be possible so use a "fake" build process for the design-time build that skips over the Java types altogether.

## Steps followed to replicate (in Cycle 9 Alpha)

1. Create a new "Visual C# > Cross-Platform > Cross Platform App".

2. Select "Template: Blank App", "UI Technology: Forms", "Sharing: PCL".

3. Open "MainActivity.cs" from the Android project.

4. Right-click on the using statements or navigate to "Edit > IntelliSense".

5. If testing with VS 2015, navigate _into_ the "Organize Usings" sub-menu.

## BAD Results in Visual Studio 2015

- At step 5 the "Organize Usings" sub-menu does _not_ include "Remove Unnecessary Usings" or "Remove and Sort Usings".  This is "bad" because for example the "using System;" line _is_ unnecessary.

- As another example, the second word "Forms" in the fully-qualified method call `global::Xamarin.Forms.Forms.Init()` is black (no syntax highlighting).  This is "bad" because it should by syntax-highlighted as a class name.

## BAD Results in Visual Studio 2013

- At step 4 the right-click context menu for the using statements does _not_ show an "Organize Usings" menu item.

- At step 4 the "Edit > IntelliSense" menu also does _not_ show an "Organize Usings" menu item.

## Additional observations

As mentioned in Comment 6, building the project and then closing and reopening the solution does appear to help with this issue.  I suspect this is very closely related to the following 2 warning messages that appear in "View > Error List" after step 2.  (See also Bug 42909.)

### Warning 1 (excerpt)

> The "ResolveLibraryProjectImports" task failed unexpectedly.
> System.IO.FileNotFoundException: Could not load assembly 'FormsPortable1, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
> File name: 'FormsPortable1.dll'
>   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)

### Warning 2

> Error encountered while loading the project. Some project features,
> such as full solution analysis for the failed project and projects
> that depend on it, have been disabled.

## Additional testing environment info (brief)

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3

Microsoft Visual Studio Enterprise 2015
Version 14.0.25425.01 Update 3

Microsoft .NET Framework
Version 4.6.01055

Windows 8.1 (64-bit), Version 6.3 (Build 9600)
Comment 12 Brendan Zagaeski (Xamarin Team, assistant) 2016-12-27 08:18:10 UTC
## Follow-up on the "Additional observations" from Comment 11

After some further testing, I determined that the problem in Bug 42909 was unrelated.

This bug (Bug 30844) is instead part of the same problem as Bug 23210.  I found that both bugs could be generalized and simplified to use a shared test case that didn't involve Xamarin.Forms.

I have filed the new generalized and simplified test case in a new bug report to provide a clean starting point for the final steps of the investigation.  I will accordingly mark this bug as a duplicate of the new bug.

*** This bug has been marked as a duplicate of bug 50914 ***