Bug 52908 - Intellisense not working properly for Android projects created with the Forms templates
Summary: Intellisense not working properly for Android projects created with the Forms...
Status: RESOLVED DUPLICATE of bug 57281
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android (show other bugs)
Version: 4.3.0 (C9)
Hardware: PC Windows
: Normal normal
Target Milestone: 15.4
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-28 17:47 UTC by Jimmy [MSFT]
Modified: 2017-06-28 20:32 UTC (History)
8 users (show)

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


Attachments
vs logs (166.50 KB, application/x-zip-compressed)
2017-02-28 17:47 UTC, Jimmy [MSFT]
Details


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 DUPLICATE of bug 57281

Description Jimmy [MSFT] 2017-02-28 17:47:17 UTC
Created attachment 20036 [details]
vs logs

### Overview
Intellisense is not working properly for Android projects created with the Forms PCL and shared project templates. 

It works successfully for the iOS and UWP projects in the same solution and also for all projects created with the native cross platform PCL/ shared project templates.

One difference I noticed when working on a file from the Android project without Intellisense is that the namespace dropdown in the editor shows "Miscellaneous Files" instead of the actual namespace: https://www.dropbox.com/s/39vrejd6ylosqle/intellisense.PNG?dl=0


### Steps to Reproduce
1. Create a new Forms PCL or shared app solution
2. Open MainAcitivty.cs in the Android project
3. Edit the class to override the OnStart() method

### Expected Results
Intellisense will help autocomplete the method definition.


### Actual Result
OnStart() does not appear in the Intellisense suggestion box.



### Version Information

#### Xamarin.Forms Template Extension 0.5.276

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA031
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.

Visual Basic 2015   00322-80000-00000-AA031
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA031
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA031
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-80000-00000-AA031
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   7.18.00214.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0
ASP.NET and Web Tools 2015.1 (Beta8)

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

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

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

GitHub.VisualStudio   2.2.0.6
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Merq   1.1.14-alpha (21c13c9)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

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

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

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

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript   1.8.36.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25527.01
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   4.3.0.784 (73f58d6)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.1.0.41 (9578cdc)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.4.0.123 (35d1ccd)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-15 21:20:30 UTC
## Note to the Xamarin team

At least for the PCL case, at least _some_ of the symptoms might be due to Bug 50914.




## Note to the reporter of the bug

If you get a chance to try it, does removing `UpdateAndroidResources` from the `$(ResolveReferencesDependsOn)` property (as described in Bug 50914, Comment 1) resolve the behaviors you are seeing?  (For example, if you apply that change and then create a new Forms project as described in Comment 0, do you get the same IntelliSense issues?)
Comment 3 Jimmy [MSFT] 2017-03-15 22:53:54 UTC
Per the suggestion in comment 2, removing `UpdateAndroidResources` from the `$(ResolveReferencesDependsOn)` property in the Xamarin.Android.Common.targets file does appear to resolve the Intellisense issue for a newly created Android Forms project. However attempting to build the project then results in a failure with the errors:

> Error	CS0117	'Resource.Layout' does not contain a definition for 'Tabbar'	App15.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App15\App15\App15.Android\MainActivity.cs	17	Active
> Error	CS0117	'Resource.Layout' does not contain a definition for 'Toolbar'	App15.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App15\App15\App15.Android\MainActivity.cs	18	Active


Looking through Resource.Designer.cs confirms that the resources are not defined even after trying to build the project. 
However after testing this, I do believe the original issue is related to the 'UpdateAndroidResources' task after all. This is because without removing the 'UpdateAndroidResources' line, you get the following errors in a new Android Forms project:

> Warning		No resource found that matches the given name: attr 'colorAccent'.	App14.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App14\App14\App14.Android\Resources\values\styles.xml	4	
> Warning		No resource found that matches the given name: attr 'colorPrimaryDark'.	App14.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App14\App14\App14.Android\Resources\values\styles.xml	2	
> Warning		No resource found that matches the given name: attr 'windowActionBar'.	App14.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App14\App14\App14.Android\Resources\values\styles.xml	2	
> Warning		Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.	App14.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App14\App14\App14.Android\Resources\values\styles.xml	2	
> Warning		No resource found that matches the given name: attr 'colorPrimary'.	App14.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App14\App14\App14.Android\Resources\values\styles.xml	2	
> Warning		No resource found that matches the given name: attr 'windowNoTitle'.	App14.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App14\App14\App14.Android\Resources\values\styles.xml	2	
> Warning		No resource found that matches the given name: attr 'colorAccent'.	App14.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App14\App14\App14.Android\Resources\values\styles.xml	3	
> Warning		Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'.	App14.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App14\App14\App14.Android\Resources\values\styles.xml	4	
> Warning		No resource found that matches the given name: attr 'windowActionModeOverlay'.	App14.Android	C:\Users\jigarrid\Documents\_Xamarin Work\App14\App14\App14.Android\Resources\values\styles.xml	4	
> Warning	IDE0006	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.	App14.Android		1	Active


But building the project will get rid of the errors AND if you reload the project (e.g. restarting VS) then Intellisense will work as expected. This would indicate the the failure to resolve the resources immediately after the project is created (and therefore VS thinking the project was not loaded successfully) is what is causing Intellisense to not work until the project is built and reloaded.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-15 22:59:54 UTC
My next question would be whether Comment 3 is the same for both the PCL case as well as the Shared project case?  If it was just one of them, how does the other type behave?
Comment 5 John Miller [MSFT] 2017-03-16 16:19:48 UTC
To try and answer Comment #4, I created both Shared and PCL based Xamarin.Forms projects from the template. Android projects experience this issue in both. iOS worked OK.
Comment 6 Jimmy [MSFT] 2017-03-16 16:28:27 UTC
I am seeing the same as comment 5. The individual PCL and shared projects in the solution work fine, only the Android project itself has this issue.

I should also note that a new native Android project does _not_ have this issue. Going back to the info in comment 3, a new native Android project does not show any of the warnings about resources not being found.
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-16 18:33:45 UTC
> Android projects experience this issue in both.

So the answer to Comment 4 actually requires 2 parts:

(a) Do both project types show the problem? (The answer this appears to be "yes" based on Comment 5 and Comment 6.)

(b) Does the `UpdateAndroidResources` workaround work in both cases?


If the answer to (b) is also "yes," then let's just go ahead and mark this bug as a duplicate of Bug 50914.  Thanks!
Comment 8 Joaquin Jares 2017-06-05 18:45:41 UTC
Miscellaneous Files will mean that the android project is not referencing the shared project. This seems to be an issue in new projects I'm investigating. Adding the reference manually should solve that issue.
Comment 9 Juan Marcelo Tondato 2017-06-28 20:32:42 UTC

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